Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Re; Reset a form based on users checkbox selection

Avatar

Avatar
Validate 1
Level 1
Yvette_s_Channe
Level 1

Likes

0 likes

Total Posts

29 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
Yvette_s_Channe
Level 1

Likes

0 likes

Total Posts

29 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile
Yvette_s_Channe
Level 1

02-04-2021

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.

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Springboard
MVP
Magus069
MVP

Likes

143 likes

Total Posts

1,077 posts

Correct Reply

155 solutions
Top badges earned
Springboard
Validate 1
Ignite 3
Ignite 1
Establish
View profile

Avatar
Springboard
MVP
Magus069
MVP

Likes

143 likes

Total Posts

1,077 posts

Correct Reply

155 solutions
Top badges earned
Springboard
Validate 1
Ignite 3
Ignite 1
Establish
View profile
Magus069
MVP

03-04-2021

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.

Answers (0)