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
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Setting hidden fields to null

Avatar

Level 10

I guess this is more of a best practices kind of question.

A filler has entered a bunch of data in a subform. They then change an earlier option which causes that subform to disappear and a different one to appear.
As well as setting mandatory fields off and on, what are people doing with the previously entered data? Leave the data alone or blank the data? Are there any problems with data in hidden subforms when it comes to exporting XML or anything like that?
The downside I can see to blanking the data is that if the filler changes their mind again they would have to re-enter the data.
1 Reply

Avatar

Level 10

Hi Jono,

I would normally null the field when it is hidden.

Depending on how the data is being submitted, you could go for something like this in the preSave or preSubmit event of the field:

if (this.parent.presence == "hidden")

{

     this.rawValue = null

}

Structure would depend on what you are hiding and how many objects you have. Also a specific resetData(), targeting particular objects could be used instead of the .rawValue=null.

Good luck,

Niall

Message was formatted and edited by: Niall O'Donovan