The current use case is to see if all fields on a form are filled out before revealing the submit button. A long conditional statement could be made to check this however I wanted to see if there was an easier method. These fields are required but it has been requested that the submit button also be hidden until all the required fields are filled out.
Question
Question
Replies
replied on June 5, 2019
Using field rules to show or hide action buttons is something we have planned for Forms 10.5.
2
0
replied on June 5, 2019
I would add a common class name to all required fields. Then on change, for each field with this class name, see if any are empty. If not, hide submit, else show submit.
For this type of thing, where the field type is unknown, you can do a check for field type. Here is an example of a function I use called Attach instead of the change method. Unlike change, it will execute my function on fields of type input or select without specifying.
//Simple method for replacing the common, on change //Usage Attach(function, 'className1', 'className2', 'etc'); function Attach() { var func = arguments[0]; for (var i = 1; i < arguments.length; i++) { if ($('.' + arguments[i]).has('input').length > 0) { $('.' + arguments[i] + ' input').on('change', func); } else if ($('.' + arguments[i]).has('select').length > 0) { $('.' + arguments[i] + ' select').on('change', func); } } }
1
0
You are not allowed to follow up in this post.