-
-
Notifications
You must be signed in to change notification settings - Fork 9
Validating field y only when field x is not null / conditional validations #12
Comments
Hmm, that is a tricky one. Fortress doesn't have any rules like this at the moment, so you will just need to implement that logic manually in your controller. |
Hi Alex! Thanks for the kind and quick response! May be this could be a common, simpler use case. let's say in a drop down or list, 'Other' is selected. jquery validation supports this as documented at https://jqueryvalidation.org/required-method (Example: Makes details required only if #other is checked.)
Hope we'll get this fortress! Thanks once again! |
So, we would need a way to generalize this across client- and server-side rules ( |
in our usecase, checked is not needed, we just need to see if the first field is not null. As a newbie to fortress am not sure about what can be proposed. However, I guess we should be able to use native jquery validate constructs in page specific block of twig template of userfrosting to handle this. Thanks! :-) |
I think the right way to do this would be to introduce "conditional rules" - rules that are only applied if a certain condition is met:
Of course, then we would need to be able to parse the expressions in |
Hi,
Greetings!
Not sure if this is the right place to request help regarding this.
Can you kindly, specify how to specify rules for field x and y,
that field y is required if field x is not null.
Thanks!!
Warm regards and gratitude,
Spurgeon
The text was updated successfully, but these errors were encountered: