You are viewing limited content. For full access, please sign in.

Question

Question

Automatically clear fields that are hidden by radio button

asked on June 10, 2020

I am building a form that has a lot of yes/no radio buttons throughout it. These radio buttons often show or hide certain fields that ask for currency input from the user. If a user enters numbers into a field and then that field is hidden by one of those radio button selections the form still uses the data they entered into the hidden field in calculations that are computed in other fields at the end of the application. Is there a way using JavaScript or CSS to clear out that data that was entered into the hidden fields? It would need to work on a per field basis and not overall because there are some fields that are always hidden that hold data that I need.

Currently the only way I've been able to do this is to write an IF statement as part of the formulas in the calculation fields. However, that gets really confusing when there are multiple radio buttons involved which hide and show different fields. 

1 0

Replies

replied on June 10, 2020

Are you setting your fields to 'Ignore data when field/section is hidden'? That would address the fields that you are hiding based on the Yes/No responses.

2 0
replied on June 10, 2020

Yes I am doing that. However that function only seems to apply when the form is submitted. It doesn't apply to other fields in the form that may have the hidden fields' variable as part of a formula.

For example, if I have Field C set up to add the value of Field A and Field B but field B is hidden, it'll still pull the value into the calculation from Field B even if I have the field rule set to ignore the data when hidden. 

0 0
replied on March 28, 2021 Show version history

Did you ever find a solution for this? I have somewhat of a similar issue.

Thanks!

0 0
replied on March 29, 2021

I have yet to find an easy solution. What I end up doing is writing IF formula's and referencing the radio button(s) that are responsible for hiding/unhiding certain fields. So for example if I am adding Field A and Field B in Field C, but Field B is hidden due RadioA selection I will write a formula for Field C like: =IF(RadioA=Yes,FieldA+FieldB,FieldA). It can get real complicated with more complex forms and calculations but it can be done. Sometime I find it helpful to breakdown the calculations into separate hidden fields to make it a little more manageable. However, it would make things so much easier if they would make a field setting that resets the value when it's hidden.

2 0
replied on October 12, 2022

Just wondering if you ever found another solution for this?

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.