5 years ago

Conditional form fields

Posted 5 years ago by alex_time

Back in my spaghetti-code I written a class that could handle conditional forms, I could, for example, ask the user if he/she was a male or female and based on that choice display (using js) some specific fields and than apply conditional validation based on the choices. Switching to L5 I know I can benefit from the new validation method where I can put logic in it, and I could write specific js on assets but there is still a problem: failing a validation in L5 mean a switch back to the previous page with precompiled fields, but if I apply js code to display a subset of fields based on other fields I guess that L5 will compile all the filds that were compiled before but I cannot handle all the show/hide actions to display the form like it was before. How do you handle such situations?

Please sign in or create an account to participate in this conversation.