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

Reset fields by page or subform

Avatar

Avatar
Validate 1
Level 1
PBingrampc
Level 1

Likes

0 likes

Total Posts

55 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
PBingrampc
Level 1

Likes

0 likes

Total Posts

55 posts

Correct Reply

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

31-05-2011

I would like any change in a pull downbox on Page 1 to reset and reload defaults on Page 2.

the first part of the question.....instead of resetting each filed one by one, is there a global script I could add to form1.Page1.region that would reset the entire page or subform to null?

This is what I'm using now

form1.Page1.region::change

this.resolveNode("Page2.LumberFramingOptions.TypicalFraming").rawValue

= null;

this.resolveNode("Page2.LumberFramingOptions.FirstFloorSystem").rawValue

= null;

this.resolveNode("Page2.LumberFramingOptions.SecondFloorSystem").rawValue

= null;

this.resolveNode("Page2.LumberFramingOptions.FirstFloorStuds").rawValue

= null;

this.resolveNode("Page2.LumberFramingOptions.SillPlate").rawValue

= null;

this.resolveNode("Page2.LumberFramingOptions.WallSheathing").rawValue

= null;

maybe something like

this.resolveNode("Page2.LumberFramingOptions.*").rawValue = null;

Hmmm...there is probably a pretty simple solution.

Thanks! PC

View Entire Topic

Avatar

Avatar
Give Back 3
Level 2
past-tense
Level 2

Likes

9 likes

Total Posts

85 posts

Correct Reply

10 solutions
Top badges earned
Give Back 3
Give Back
Validate 1
Boost 5
Boost 3
View profile

Avatar
Give Back 3
Level 2
past-tense
Level 2

Likes

9 likes

Total Posts

85 posts

Correct Reply

10 solutions
Top badges earned
Give Back 3
Give Back
Validate 1
Boost 5
Boost 3
View profile
past-tense
Level 2

24-10-2011

Hi there,

Am I right to assume that you want the fields on the hidden subform to be null instead of their default value because you plan on exporting the data? The reason why I made that assumption is because I personally don't see any other value to nulling out hidden fields, unless it's in order to clean up the exported data....

If that's right, nulling the fields still won't remove them from the exported XML. The nodes just wouldn't have a value... i.e.

<formroot>

   <hiddensubform01>

      <nullnode01 />

      <nullnode02 />

   </hiddensubform01>

   <visiblesubform01>

      <node01>value01</node01>

      <node02>value02</node02>

   </visiblesubform01>

</formroot>

If you want to exclude the nodes for the hidden subform altogether, you should look at making hiddensubform01 a repeatable subform, with min-count = 0 and max-count=1. Then use "_hiddensubform01.setInstances(0)" to 'hide' the subform, and "_hiddensubform01.setInstances(1)" to show it. You can add this code to the initialize and change events of the radio button. Note the underscore before the subform name... you need to use the underscore when you're dealing with repeatable subforms with a min-count of 0.

If you so it this way, when you set the instance count to 0 using "_hiddensubform01.setInstances(0)", The xml will look like this:

<formroot>

   <visiblesubform01>

      <node01>value01</node01>

      <node02>value02</node02>

   </visiblesubform01>

</formroot>

.... and when you set the instance count to 1, it will look like this:

<formroot>

   <hiddensubform01>

      <nullnode01>default value 1</nullnode01>

      <nullnode02>default value 2</nullnode02>

   </hiddensubform01>

   <visiblesubform01>

      <node01>value01</node01>

      <node02>value02</node02>

   </visiblesubform01>

</formroot>

Another neat thing about this method is that using the setInstances() method resets the subform fields to their default values, so you wan't need to use resetData() anymore.

Hope that helps!

- Scott

PS. Even if you weren't indtending to export the xml, the above method is still a very clean way to 'null' out all of the fields while the subform is 'hidden' and to reset them to their default value when they are 'shown.' This way also has the benefit of not having to 'resolvenode' for every field. You just need to set the instance count on the parent repeatable subform, and this affects all child nodes visibility/rawvalues. in on go. If You need anything clarified, or if you have any questions regarding this method, just let me know.