Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions

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

Userforms :: validation bug


Go to End
Reply

21 Posts   5539 Views

Avatar
Junglefish

17 September 2009 at 1:45am Community Member, 104 Posts

Hi all

Just set up a basic user form, nothing fancy. Set a couple of fields to be mandatory and I'm getting script errors on page load.

Firebug says:

$("#Form_Form").validate is not a function

and points to this line of code in the source:

, EditableDropdown19:{
required:1
}

If I then make that field not mandatory and run the page again, Firebug says the same and points me at the source code for the previous formfield:

, EditableTextField18:{
maxlength:"1000"
}

and so on.

Anyone seen this before or know what's happening?

jf/

Avatar
dalesaurus

17 September 2009 at 3:18am Community Member, 283 Posts

Sounds like a javascript namespace issue. Are you including jQuery or some other framework that would interfere with the default Prototype use of $?

Avatar
Junglefish

17 September 2009 at 7:45pm Community Member, 104 Posts

@dalesaurus. No, I'm not specifically including anything special, I'm just using a standard SS installation, nothing fancy.

Avatar
dalesaurus

18 September 2009 at 4:06am Community Member, 283 Posts

Hmmmm, can't troubleshoot without some more information. Can you post your form code and/or point to a live site to see the error?

Avatar
Junglefish

18 September 2009 at 11:22pm Community Member, 104 Posts

@dalesaurus. Okay, I've saved out the source code of the page in question, and it's attached.

I notice that the $("#Form_Form").validate() function appears to be included on the page twice. Is this normal?
Also, there is a call to a JQuery script just above those functions, but that's SS just doing what it normally does, no?

jf/

Attached Files
Avatar
dalesaurus

19 September 2009 at 2:42am Community Member, 283 Posts

Sorry I wasn't clear, I meant the PHP source code. Are you writing your own forms or is this from the UserForms module? I see that your date fields are not the standard 2.3.3 validated with Prototype/Behaviour. Are you using a beta version of SS?

SS Forms are pretty bang-bang out of the box, if you are having this much trouble something is wrong.

Avatar
Willr

19 September 2009 at 10:55am Forum Moderator, 5511 Posts

SS Forms are pretty bang-bang out of the box.. Quote of the day! Nice one dalesaurus :)

Avatar
Junglefish

21 September 2009 at 8:03pm Community Member, 104 Posts

@dalesaurus.

I'm using a standard installation of SilverStripe CMS - 2.3.3 and the form is generated by the UserForms module.

Which php files are you interested in looking at?

jf/

Go to Top