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

adding javascript to a form


Reply


2 Posts   995 Views

Avatar
TerryMiddleton

Community Member, 108 Posts

19 May 2009 at 3:43am

How do you add javascript processing to a form?

I see that it builds the js for the form when you have required field. How can I add a little more process like: is field x a certain length?

I have the code, I just don't know how t add it to the form processing?

Terry

Avatar
Willr

Forum Moderator, 5513 Posts

19 May 2009 at 1:44pm

In the function you are outputing the form in - like function Form() you need to include Requirements::customScript("My JS HERE") or Requirements::javascript("link/to/file.js"); which will include the given JS with the form