Jump to:

22975 Posts in 11620 Topics by 2826 members

General Questions

SilverStripe Forums » General Questions » Userforms and email validation

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 957 Views
  • classicalbass
    Avatar
    Community Member
    2 Posts

    Userforms and email validation Link to this post

    This is my first Silverstripe project and so far so good. I've managed to get three different jquery routines to work in my application, (two menus and one image display.)

    I am attempting to implement the userforms module but I can't get the jquery email address validation to work.
    I can see the jquery.validate.js file is where it should be and everything else works, but I can put garbage of any kind in the email field and it passes successfully.
    I've pasted the relevant code from "view page source" below, just to verify that the jquery routine is there.
    Is there something I'm missing?

    <script type="text/javascript" src="http://mydomain.com/sapphire/thirdparty/jquery/jquery.js?m=1292911507"></script><script type="text/javascript" src="http://mydomain.com/userforms/thirdparty/jquery-validate/jquery.validate.min.js?m=1298687018"></script><script type="text/javascript">//<![CDATA[
             (function($) {
                $(document).ready(function() {
                   $("#Form_Form").validate({
                      errorClass: "required",   
                      messages:
                         {
    EditableTextField1:"Please enter your name.", EditableTextField2:"Test error message."
    }
                      ,
                      rules:
                          {
    EditableTextField1:{
    required:1, minlength:"2", maxlength:"45"
    }
    , EditableTextField2:{
    required:1
    }

    }
                   });
                });
             })(jQuery);

    //]]></script><script type="text/javascript">//<![CDATA[
             (function($) {
                $(document).ready(function() {
                   
                   
                })
             })(jQuery);

    //]]></script>

  • Willr
    Avatar
    Forum Moderator
    5462 Posts

    Re: Userforms and email validation Link to this post

    Have you used an "Email Field" in the UDF? Looking at the jQuery you only have text fields (which don't have any email validation). "EditableTextField2" should be "EditableEmailField2" and should have an option email: true to trigger the validation.

  • classicalbass
    Avatar
    Community Member
    2 Posts

    Re: Userforms and email validation Link to this post

    Oh, good grief! I thought I had double checked that. Such a simple thing and that's what the problem was. (What a way to introduce myself to this forum. )

    Thanks for a quick response.

    957 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.