Jump to:

23379 Posts in 18298 Topics by 2867 members

General Questions

SilverStripe Forums » General Questions » Contact Form and Signup Form validation clashing

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: 1521 Views
  • Briohny
    Avatar
    Community Member
    199 Posts

    Contact Form and Signup Form validation clashing Link to this post

    I have a contact (userdefined form) and a newsletter signup ($SignUpForm) on the same page. The validation is messy. When you hit submit on the contact form, an error message appears 'object does not support this property or method' and the form validation fields turn from strings to 'EditableEmailField3 is required'.

    Does anyone know how i can fix this please?

    Many thanks.

  • Aram
    Avatar
    Community Member
    598 Posts

    Re: Contact Form and Signup Form validation clashing Link to this post

    Hi Briohny

    I had this issue to and didn't find a way to have the SS validator working on two form siultaniously so I just disabled it from one of them changing the id of the <form> element from 'Form_Form' to 'QuestionForm' using a line of jQuery: $('#questionForm form').attr('id', 'QuestionForm');

    I then wrote a simple jQuery validator to replace it on that form.

    Hope that helps

    Aram

  • TerryMiddleton
    Avatar
    Community Member
    108 Posts

    Re: Contact Form and Signup Form validation clashing Link to this post

    Aram & Briohny,

    So, this may be a sort of different question than the two forms issue, however I'm trying to ADD a form field validation and I can't seem to figure it out.

    On my customform, can I simply add a validator just for the field I'm trying to validate. It looks like for required fields the validator is already add.

    Then, what in the world does this look like?

    Thanks for your insight,

    Terry

  • Aram
    Avatar
    Community Member
    598 Posts

    Re: Contact Form and Signup Form validation clashing Link to this post

    Hi Terry

    if you look at my tutorial for creating a simple contact form in part 2 you will see a bit where we define $validator[ with the names of the fields we want to be validated. Then you just pass this into the Form() function as an argument and that's it, validation added

    EDIT: actually I think I misunderstood your question......not entirely sure what you mean, you don't want to add a required field but you do want it to be validated? I'm confused :s

  • TerryMiddleton
    Avatar
    Community Member
    108 Posts

    Re: Contact Form and Signup Form validation clashing Link to this post

    Aram,

    My apologies for the confusion.

    I actually do have a required field that I also need to add some more validation to. Specifically, I have a phone number field that is required and I also need to make sure the field has at least 10 digits to it.

    Everything works perfectly, except now I need to add the extra validation for the 10 digits on the phone #.

    I'll check out the tutorial. Thank you for responding. I'm (I pray) down to the last 10 items that the client is asking for and I can go live. (first SS project)

    Thanks again,

    Terry

  • Aram
    Avatar
    Community Member
    598 Posts

    Re: Contact Form and Signup Form validation clashing Link to this post

    Ahh ok I am with you now. There is a phone number field although it's for newzeland numbers so not sure it it will do what you want.

    Otherwise if I were you I would remove the SS validation from the field and then add some custom jquery validation to the field using a seperate script.

    And ignore my reference to that tutorial, it wont help

  • Aram
    Avatar
    Community Member
    598 Posts
  • TerryMiddleton
    Avatar
    Community Member
    108 Posts

    Re: Contact Form and Signup Form validation clashing Link to this post

    Aram,

    yeah, yeah - I was headed that way with the jquery validation, then my brain got tweated on how to implement it.

    I'll head back to the jquery solution.

    Thanks,

    Terry

    1521 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.