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.

Form Questions /

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

Form Validation not working if jquery is included


Go to End


4 Posts   10292 Views

Avatar
spierala

Community Member, 80 Posts

19 February 2010 at 2:36am

Hallo all,

I have strange problem:
Silverstripe form validation is not working any more as soon as I add jquery manually in Page.ss by

<% require javascript(mysite/javascript/jquery.js) %>

I get following Error in Firefox when I press the send button of the form:
$("AngebotForm_AngebotForm").validateEmailField is not a function

it seems somehow jquery is not found. Perhaps the form validation add it´s own jquery and that causes the trouble?

I´ve created my form using a custom template as described here:
http://doc.silverstripe.org/doku.php?id=form#using_a_custom_template

Many thanx for your help,
florian

Avatar
me.yay

Community Member, 14 Posts

20 February 2010 at 9:56pm

Edited: 20/02/2010 9:56pm

Hey Spierala,

form validation is done using protype by default. If you want to use jQuery form validation you need to create your own form (tutorial available: http://www.ssbits.com/using-jquery-for-form-validation/ ) or use the module UserForm 0.2.x to create a form.

Did you check your sites sourcecode in your browser after page is rendered? Though it's more comfy to use firebug's "console" tab.
Did you check for version missmatch of your and the implicit loaded jquery.js?

kind regards
Metin

Avatar
spierala

Community Member, 80 Posts

21 February 2010 at 2:52am

heee metin,

funny, i did it already exactly that way using the same tutorial. works fine for me.

thanx,
florian

Avatar
netnoise

Community Member, 10 Posts

28 February 2010 at 11:38pm

Try jQuery.noConflict() if you use jQuery together with PrototypeJS.