How to clear field that is displayed only if a value in another field is selected

expressions
(Eleshia Robinson) #1

I have 2 fields:

  1. Violation Present? (Yes/No)
  2. Violation Details (Text)

The Violation Details field is set to be shown if and required if Violation Present = TRUE.
The user selects Violation Present = TRUE, then enters a value for the Violation Details.
If they then change their mind and set Violation Present = False, the Violation Details is immediately hidden. However, the value they entered into the Violation Details still gets saved with the record. How can I clear the value from the Violation Details when the user changes the other field from TRUE to FALSE or anytime the field gets hidden?

(Marc Dillon) #2

I’ve encountered the same problem a number of times. Unfortunately there does not seem to be an easy way to do this, but you do have a few options to get around it.

1.) Whatever fields access that value later, you can make their access also depend on the true/false value of the 1st column.
2.) Add a virtual column with expression IF(ISBLANK([violation present]) , [violation details] , “no violation”), or some-such, and use that VC for any further fields.
3.) Change data workflow that will clear the value of column 2 if column 1 is set to false.
4.) Only a kind-of solution; set initial value of column 2 to “”, and enable Reset on Edit.

2 Likes
#3

@Eleshia_Robinson
Maybe I am missing the issue here, but can’t you just change the ShowIf to be:
OR(
[Violation Present]= TRUE,
NOTISBLANK[Violation Details]
)

(Eleshia Robinson) #4

The issue is that I don’t want any value saved in the Violation Details if the Violation Present field is set to False. I could use your suggestion to keep the field visible and ask the users to clear the VD field manually, or even force them to do that. Just trying to avoid manual processes for the user.

(Steve Coile) #5

@Marc_Dillon covered all the bases in his reply. #3 seems the best to me. Note, though, it doesn’t need to be a change workflow; it could also be a form-saved action.

1 Like