Blank out input if button choice changes (show_if)

I have a question that I am not sure can be solved. We have setup the app as a survey where there are a number of show_if conditions if you answer a question a certain way. eg.

  1. Is there a business in this property? Y/N
  2. What is the name of the business (show_if question 1 = Yes)

This is the correct logic however the following can occur:

  1. The first question is Yes
  2. Question about business name appears. The user fills in the business name

*3 HOWEVER, they figure they have made a mistake and and put the first question back to No.
4. The business name question disappears as it should, however the name they filled in will still be saved in the table.

Needless to say there is a risk with regards to data quality. Is there any structural way to handle this or do I need to create an action for each show_if in my survey :frowning:

Thanks in advance.

I’m not familiar with any built-in way to erase the value of a dependent column that’s already been edited by the user. Once the user’s modified the value, the automatic expressions (i.e., initial value) no longer have any effect, so cannot blank the value.

1 Like

I have the same issue. I’m still trying to figure out if there is a work around to clear the dependent data. In my mind, that data shouldn’t be saved yet if they are still on the same data entry record.

@Steve

I did the following and it appears to clear the dependent dropdowns if the user selects IS_GEO=FALSE.

  1. created an action to clear the GEO_NO and COUNTRY_GEO_NO which should NOT have a value if IS_GEO=FALSE

  1. created a behavior to run that action when records are added or updated, if IS_GEO=FALSE

  2. for testing purposes I added a confirmation dialog to see if it was actually being called. This dialog appears immediately after I click the SAVE button

  3. IS_GEO’s initial value is FALSE which hides the Region and Country dependent drop downs
    Screen Shot 2020-05-08 at 12.17.11 PM

  4. When IS_GEO is set to TRUE, the dependent drop downs appear and I selected values in each combo box
    Screen Shot 2020-05-08 at 12.17.31 PM

  5. Filled our rest of form but changed IS_GEO to FALSE BEFORE saving. That is when the behavior ran and presented the dialog box.

I clicked yes and the record was saved.

Then I clicked on the sync button and the record was synced.

I switched to the data source and you actually see that the data for GEO_NO and COUNTRY_GEO_NO was saved then erased from the data source.

This may not be an efficient way of doing it but appears to work.

Steve, do you see any problems with this method?

3 Likes

Hi Lucinda,

Thanks for contributing. Similar to your solution, I had also created actions however it would be a huge task for me to create enough actions to deal with all my needs.

Alternatively I may try adding a logical IF statement in one single action similar to what you did, but iterating through the selections on my form to blank input based on the end state of the form on save. In my case this may be the only way. Not sure what the performance issues may be.

1 Like

@Lucinda_Mason, well done! Now I would challenge you to figure out how to accomplish this with a form on-save action, rather than with a workflow. :slight_smile:

2 Likes

@Steve

I think I was already doing that. The form save event was my action. I disabled the workflow and it still worked.

Does the workflow need to be placed somewhere to be called or does it run simply by existing? It seems like it isn’t needed or is it?

Yes, there is SO MUCH I haven’t learned.

1 Like

If the action is attached to the form’s on-save event, there should be no need for the workflow.

Great. Thanks for being a great teacher

1 Like