I have a form with four check boxes.
Water, Soda, Ice, Plain
If the users toggles between them, I need the form to reset because they selected another checkbox. I would like the "Completed" button to clear all fields and subforms.
Thank you in advance.
Solved! Go to Solution.
Views
Replies
Total Likes
Hi there,
First, do you have any experience with the software or JavaScript?
By the look of it, you seem to be working with radio buttons instead of check boxes. Radio buttons is a list of items which the user can only select 1 at a time. This is only technical question to start with, no intention to offense you.
To reset a form, you can always use the method xfa.host.resetData(); which will reset all fields to default value.
This method will also remove the user's new selection. To be able to reset only parts of the form you may want to add a subform's somExpression as parameter to reset only that part of the form. Let's say you want to reset multiple subforms at a time that does not contain the 4 main checkboxes you could use the following:
xfa.host.resetData(subFormWater.somExpression + "," + subFormSoda.somExpression + "," + subFormIce.somExpression + "," + subFormPlain.somExpression);
the name preceding the "somExpression" should be the correct reference syntax to access the appropriate subform that relates to the 4 main options.
resetData function can only have 1 parameter at time, but you can concatenate all the parameters with commas into 1 string which will act as if you inserted multiple parameters.
In case that all the subforms are all in 1 subform, you can simply write one subform's somExpression.
xfa.host.resetData(subFormData.somExpression);
I hope this will help.
Let me know if you have any questions.
Views
Replies
Total Likes
Hi there,
First, do you have any experience with the software or JavaScript?
By the look of it, you seem to be working with radio buttons instead of check boxes. Radio buttons is a list of items which the user can only select 1 at a time. This is only technical question to start with, no intention to offense you.
To reset a form, you can always use the method xfa.host.resetData(); which will reset all fields to default value.
This method will also remove the user's new selection. To be able to reset only parts of the form you may want to add a subform's somExpression as parameter to reset only that part of the form. Let's say you want to reset multiple subforms at a time that does not contain the 4 main checkboxes you could use the following:
xfa.host.resetData(subFormWater.somExpression + "," + subFormSoda.somExpression + "," + subFormIce.somExpression + "," + subFormPlain.somExpression);
the name preceding the "somExpression" should be the correct reference syntax to access the appropriate subform that relates to the 4 main options.
resetData function can only have 1 parameter at time, but you can concatenate all the parameters with commas into 1 string which will act as if you inserted multiple parameters.
In case that all the subforms are all in 1 subform, you can simply write one subform's somExpression.
xfa.host.resetData(subFormData.somExpression);
I hope this will help.
Let me know if you have any questions.
Views
Replies
Total Likes
Thank you for responding.
I am not a JavaScript guru, If the user makes a selection in the "Canopy" dropdown and changes their mind and goes back and selects something else in the "Canopy" dropdown that subform resets. The current reset "xfa.host.resetData();" only resets the fields in the Canopy subform. (current subform). I would like all subforms/fields in the form to reset.
Thank you in advance,
Views
Replies
Total Likes
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies