We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 34861
    • 1 Posts
    Hi guyz! I’m looking for some help... So i have this function
    <?php
    function checkMail($email){
    if (!preg_match('/^[a-z0-9&\'\.\-_\+]+@[a-z0-9\-]+\.([a-z0-9\-]+\.)*+[a-z]{2}/is', $email))
    {
    return false;
    }else{
    return true;
    }}
    ?>

    and this form
    [+validationmessage+]
    <form method="post" action="[~[*id*]~]"><input type="hidden" name="formid" value="feedbackForm" />
    ... 
    <input maxlength="30" name="email" type="text" size="40" eForm="Your Email Address:email:1:Podaj prawidłowy adres e-mail!:#FUNCTION checkMail"  /><br><br>
    ...
    

    And of course this:
    [!eForm_functions!]
    [!eForm? &formid=`feedbackForm` &tpl=`eFeedBackForm` &report=`eFeedBackReport` &to=`[email protected]` &subject=`Wiadomosc` &vericode=`1`!]

    "eForm_functions" is the snippet that contain my function to check an e-mail.
    Could anyone help me to make it work? I need to validate if the e-mail address is correct.
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      eForm has its own email validation function for the :email: type; I don’t know if add your own validation in this case will be a problem though. Try declaring it as a :string: type instead.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org