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

adding javascript to a form


Go to End


2 Posts   1552 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, 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