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.

Archive /

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

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

validation issue


Reply


2 Posts   1334 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.