cancel
Showing results for 
Search instead for 
Did you mean: 
Workflow Hero

When hiding a field, I'd like to clear the field...

Jump to solution

... w/o having to write a chunk of JS code each time. Is there something built into the Rules Engine to clear a field when it is hidden by a rule? I've searched the Nintex Connect Community for hours

Why would I want to do this you ask?

If a form user fills in a field that becomes irrelevant and is hidden, why would I want to store the irrelevant data?

Don't you just hate people who answer a question with a question?

I've written Custom JS to take care of it, but am hoping there is something built in. A function/method, etc.

Thanks mis amigos!

Labels: (3)
Tags (1)
0 Kudos
Reply
12 Replies
Workflow Hero

Re: When hiding a field, I'd like to clear the field...

Jump to solution

Hi, 

If you aim to save empty value once field is hidden, add a calculated value connected to the same SP list column as per the fiel and set its visibility rule to the opposite of the field. Keep the calculated value empty so that once field is hidden, calculated value is shown and save empty value to SP list connected column.

*- Make sure to work on visibility from control settings (Expression) so HTML of the field/calculated value is totally removed from the page and thus no save conflict will happen.

Regards,

Reply
Workflow Hero

Re: When hiding a field, I'd like to clear the field...

Jump to solution

Really like this tip but the visibility expression doesn't allow to reference named controls. If I'd use a checkbox to hide the first control I can't check the same checkbox in the visibility expression, right? Or do I miss something?

0 Kudos
Reply
Workflow Hero

Re: When hiding a field, I'd like to clear the field...

Jump to solution

No intention on saving an empty value one the field is hidden. Why would I do that? I find this answer somewhat strange in that my question had nothing about saving. I asked if there was something built in to clear the field upon being hidden.

Perhaps a little more detail will help. Smiley Happy

I have a drop down.

In the drop down there is one item that triggers a field to be unhidden.

If for some reason a form user should fill this field in with data and then decide to change their drop down choice, hidding the field they just filled in, I want it to be cleared. The data has become irrelivent as the drop down choice has changed.

I clear the field using javascript now. Works fine. Just wondered why there wouldn't be an option to clear the filed once it is hidden. Thus preventing the capture of irrelivent data.

As I read my response, I wonder if hidden values are even saved, hmmmmm. I'm gonna do some testing...

Reply
Workflow Hero

Re: When hiding a field, I'd like to clear the field...

Jump to solution

unfortunatelly, there is not anything OOTB that would clear hidden controls.

only available option is javascript.

and yes, once hidden controls are connected to list fields they will be saved (sometimes that's very useful ...)

Reply
Workflow Hero

Re: When hiding a field, I'd like to clear the field...

Jump to solution

Just tested and the outcome is what I expected.

I selected the choice in the dropdown that shows the field

I filled in the field

Change my choice in the dropdown (thus hiding the field)

Submitted the form

Filed value was submitted

Maybe I'm out on a limb here, but that is not desirable behavior.

If there is nothing built in, I will stick with my custom JavaScript solution.

Reply
Workflow Hero

Re: When hiding a field, I'd like to clear the field...

Jump to solution

Ya, I see where it could be useful (Tabs, Wizards, etc.), however, an option in the field settings would allow either behavior or a method in the Rules Builder.

Oh, well, worth the ask.

Thanks all!

Reply
Workflow Hero

Re: When hiding a field, I'd like to clear the field...

Jump to solution

I understand you haven't got an answer you expected, but just to close the topic could you mark one of the posts as correct answer?

Reply
Workflow Hero

Re: When hiding a field, I'd like to clear the field...

Jump to solution

would be perfect if you do share your solution to this matter?

I also have 3 choices whereby 2 of them are hidden, depending which option is selected.

If you preselect an option, the value remain the same even if you change to a different option.

How can I clear the selected option IF it has been changed .... ??

Reply
Workflow Hero

Re: When hiding a field, I'd like to clear the field...

Jump to solution

Bill Rishsew Could you share you JS that you use to do this? This is exactly what I am looking for.

Thanks

0 Kudos
Reply