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.

Archive /

Our old forums are still available as a read-only archive.

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

validation issue


Go to End


2 Posts   1588 Views

Avatar
blaater

Community Member, 22 Posts

9 January 2008 at 9:20pm

Hello,

Currently I'm building a site with silverstripe 2.1 that has lots of forms that need validation. The most of the formfields I can validate using the RequiredFields class, but I have some formelements that are only visible when the previous question is answered yes. Is it possible to create some validation that checks the previous question and when needed the validation is added?

Thanks for your help!

Avatar
Ingo

Forum Moderator, 801 Posts

12 January 2008 at 1:52pm

hm your best bet is probably to subclass RequireFields and overload the javascript() method with your own client-side validation. unfortunately we can't directly append javascript event-handlers to a form-onsubmit because of the way our validator works.