Mautic Community Forums

Email Validation

Hello again

i was trying to put toe script to work but for some reason i can’t i follow all your steps and not luck.



Here is my codes

Validation Script

Code:

Form Code:
Code:
      <div class="mauticform-page-wrapper mauticform-page-1" data-mautic-form-page="1">

        <div id="mauticform_emailvalidation_email"  class="mauticform-row mauticform-email mauticform-field-1">
            <label id="mauticform_label_emailvalidation_email" for="mauticform_input_emailvalidation_email" class="mauticform-label">email</label>
            <input id="mauticform_input_emailvalidation_email" name="mauticform[email]" value="" class="mauticform-input" type="email" />
            <span class="mauticform-errormsg" style="display: none;"></span>
        </div>

        <div id="mauticform_emailvalidation_submit"  class="mauticform-row mauticform-button-wrapper mauticform-field-2">
            <button type="submit" name="mauticform[submit]" id="mauticform_input_emailvalidation_submit" name="mauticform[submit]" value="" class="mauticform-button btn btn-default" value="1">Submit</button>
        </div>
        </div>
    </div>

    <input type="hidden" name="mauticform[formId]" id="mauticform_emailvalidation_id" value="50"/>
    <input type="hidden" name="mauticform[return]" id="mauticform_emailvalidation_return" value=""/>
    <input type="hidden" name="mauticform[formName]" id="mauticform_emailvalidation_name" value="emailvalidation"/>

Any idea?

Thanks again.

Hello again
i was trying to put toe script to work but for some reason i can’t i follow all your steps and not luck.

Here is my codes
Validation Script

<script type="text/javascript"> $(document).ready(function(e){ $('#mauticform_input_emailvalidation_submit').click(function(){ var email = $('#mauticform_input_emailvalidation_email').val(); var reg = /^w+([.-]?w+)*@(?!gmail.com)w+([.-]?w+)*(.w{2,3})+$/; if (reg.test(email)){ return 0; } else{ alert('Please enter a valid company email address'); return false; } }); }); </script>

Form Code:

<div id="mauticform_wrapper_emailvalidation" class="mauticform_wrapper">
    <form autocomplete="false" role="form" method="post" action="http://domain.com/form/submit?formId=50" id="mauticform_emailvalidation" data-mautic-form="emailvalidation">
        <div class="mauticform-error" id="mauticform_emailvalidation_error"></div>
        <div class="mauticform-message" id="mauticform_emailvalidation_message"></div>
        <div class="mauticform-innerform">

            
          <div class="mauticform-page-wrapper mauticform-page-1" data-mautic-form-page="1">

            <div id="mauticform_emailvalidation_email"  class="mauticform-row mauticform-email mauticform-field-1">
                <label id="mauticform_label_emailvalidation_email" for="mauticform_input_emailvalidation_email" class="mauticform-label">email</label>
                <input id="mauticform_input_emailvalidation_email" name="mauticform[email]" value="" class="mauticform-input" type="email" />
                <span class="mauticform-errormsg" style="display: none;"></span>
            </div>

            <div id="mauticform_emailvalidation_submit"  class="mauticform-row mauticform-button-wrapper mauticform-field-2">
                <button type="submit" name="mauticform[submit]" id="mauticform_input_emailvalidation_submit" name="mauticform[submit]" value="" class="mauticform-button btn btn-default" value="1">Submit</button>
            </div>
            </div>
        </div>

        <input type="hidden" name="mauticform[formId]" id="mauticform_emailvalidation_id" value="50"/>
        <input type="hidden" name="mauticform[return]" id="mauticform_emailvalidation_return" value=""/>
        <input type="hidden" name="mauticform[formName]" id="mauticform_emailvalidation_name" value="emailvalidation"/>
</form>
</div>

Any idea?

Thanks again.