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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

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

adding javascript to a form

Go to End

2 Posts   1332 Views


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?



Forum Moderator, 5523 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