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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

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

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

Userforms :: validation bug


Go to End


21 Posts   7696 Views

Avatar
Junglefish

Community Member, 109 Posts

17 September 2009 at 1:45am

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

Community Member, 283 Posts

17 September 2009 at 3:18am

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

Community Member, 109 Posts

17 September 2009 at 7:45pm

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

Avatar
dalesaurus

Community Member, 283 Posts

18 September 2009 at 4:06am

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

Community Member, 109 Posts

18 September 2009 at 11:22pm

@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

Community Member, 283 Posts

19 September 2009 at 2:42am

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

Forum Moderator, 5523 Posts

19 September 2009 at 10:55am

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

Avatar
Junglefish

Community Member, 109 Posts

21 September 2009 at 8:03pm

@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