cancel
Showing results for 
Search instead for 
Did you mean: 
danyale
Nintex Newbie

Do not save data for disable fields 

I am having 2 radio buttons in a repeating section of the form.

The two options allows two panel (having many controls) in the repeating section to be disable and enable.

The problem is coming when the user write in a panel (having many controls in it)  than disable it by radio button, then user will have to fill the form for enable panel. i.e both the panels will have data in it. 

When I am submitting the task form, both the sections are being saved. I only wanted to save the section which was enable by radio button on the task the form. Or if there is another way to reset panel when the radio button disable a section. 

Please see image in the attachment for more clarify.

Labels: (2)
0 Kudos
Reply
5 Replies
Automation Master
Automation Master

Re: Do not save data for disable fields 

Hello,

I would write some Javascript on the change event of the radio button to clear the fields when a change in selection is made.   I assume you are using classic on prem forms, correct?  Unfortunately JS is the only real way to solve this issue with this version of forms as there are no built in rules to clear the fields.

A code-less alternative would be to disable the selection of the radio button once any of the fields have text in it.  This can be done using the built in rules on Nintex forms and checking for isnullorempty.  This would force the user to manually  delete what they typed from one section before selection the radio button to fill in the other section.  I assume you only what ONE or the OTHER sections filled out, and if so, though tedious on the user, it will quickly train them what not to do.

Thanks

Mike

0 Kudos
Reply
danyale
Nintex Newbie

Re: Do not save data for disable fields 

Thanks Mike for your suggestion. Yes I am using classic on prem forms. I have tried this using JavaScript. Since this is happening in the repeating section, the problem that I am facing is that my JavaScript is running only for the first row in the repeating section. Can I make this JavaScript run in all the rows?

0 Kudos
Reply
Automation Master
Automation Master

Re: Do not save data for disable fields 

Here is brief example of how to accomplish this. 

Form Setup


Besides the Repeating Section, I've created (3) Controls: 

  1. Choice Control - OracleSelector:

  2. Single Line Text Control - ParkOption:



  3. Single Line Text Control - EntryOption: 

Once you have all of your controls into place, you'll need to generate a unique Formatting Rule for both 'types' of Controls. When I say 'Type' in this way, I mean, which one of the two Oracle Selections ("By Entry" or "By Park") you'd like the Control to be active for.

For Controls that should be ACTIVE when "By Park" has been selected, you'll use the following Rule: 

  • Picture Examples: 


    (From the Form Editor)



    (In the Rule's Formula Builder)


  • Actual Code:

For Controls that should be ACTIVE when "By Entry" has been selected, you'll use the following Rule: 

  • Picture Example: 

    (From the Form Editor)



    (In the Rule's Formula Builder)


  • Actual Code:

    • For Controls that should be ACTIVE when "By Park" has been selected:
      (function(formControlCall, oracleSelector, controlType) {
        var formControlID = formControlCall.split("'")[1] || "";
        var targetControl = sourceContext.find("[formcontrolid='" + formControlID + "'].nf-filler-control");
        var innerControl = NWF$(targetControl.find("[formcontrolid][id]")[0]);
        var returnValue = oracleSelector !== controlType;
       
        if ( returnValue && innerControl.val()) {
          innerControl.val("").trigger("blur");
        }

        return returnValue;
      }("{ControlSmiley Frustratedelf}", OracleSelector, "By Park"))‍‍‍‍‍‍‍‍‍‍‍‍


    • For Controls that should be ACTIVE when "By Entry" has been selected:
      (function(formControlCall, oracleSelector, controlType) {
        var formControlID = formControlCall.split("'")[1] || "";
        var targetControl = sourceContext.find("[formcontrolid='" + formControlID + "'].nf-filler-control");
        var innerControl = NWF$(targetControl.find("[formcontrolid][id]")[0]);
        var returnValue = oracleSelector !== controlType;
       
        if ( returnValue && innerControl.val()) {
          innerControl.val("").trigger("blur");
        }

        return returnValue;
      }("{ControlSmiley Frustratedelf}", OracleSelector, "By Entry"))‍‍‍‍‍‍‍‍‍‍‍‍

      (Please note that while you can copy and paste this code directly into the Formula of the Rule, you will need to replace the 'OracleSelector' placeholder at the very bottom of the code with the actual Named Control reference as shown in the pictures above)

Doing that should result in the following behavior

Default State: 

When 'By Park' is selected: 

When 'By Entry' is selected: 

I hope that this helps you to solve your problem. 

Reply
satya_divi
Nintex Newbie

Re: Do not save data for disable fields 

That was awesome, I was looking for something like this, it helped me.

0 Kudos
Reply
Highlighted
Automation Master
Automation Master

Re: Do not save data for disable fields 

Excellent! That's great to hear! 

Reply