I want to reset the option button values based on another option button value


Badge +2

I have a option button with 3 values.

Based on the each value i am loading a panel with controls in it.

i want to reset the values in the panel when the option button value is changed to different value.

Eg:  Option button

Value 1--- Panel1(controls)

Value2---Panel2(controls)

When value1 is changed to value 2 i want to reset the controls in panel one.


13 replies

Userlevel 5
Badge +14

to set 'Option 1' checked you can

NWF$("#"+varControl).find("input[value='Option 1']")[0].checked=true

Badge +2

I am looking to reset values in the panel when another choice is selected.

Userlevel 5
Badge +14

you have to do 'reset' per every single control, there is no general function that would do it for all the controls in a panel.

since you named the topic "I want to reset the option button values" I provided an example for option buttons. if you need for another controls, please specify exactly what you need.

Badge +2

I have 3 panels with multiple option buttons in each panel. A single panel loads based on the value of the option button selected. But when the option button value is changed i want to reset the values option buttons in the panel.

Badge +2

I am using the below to reset the values to default value but i am unsuccessful

NWF$(document).ready(function(){ 

var obj = NWF$("#" +Choices); 

obj.change(function(){

NWF$("#" + TextBox ).val('');

} );

} );

Userlevel 5
Badge +14

if you correctly set up javascript variables for your Chioces and TextBox controls your code should work.

do you get any error on developer console?

Badge +2

Can you help me with javascript set up as i am unable to move forward on this.

I am using the javascript in the form setting custom java script section and enabling the javascript client id to yes and providing the javascript variable to all the controls.

Thanks in advance.

Userlevel 5
Badge +14

that all sounds to be correct.

I've just taken your script and copy&paste it to my custom javascript (with no change).

then I placed a choice control on the form and configured javascript variable to 'Choices'

similarly I did for 'TextBox'

when I ran the form

and changed an choice option, text box got correctly cleared

Badge +2

Thanks for the help.

But I wanted it for the option box instead of text box.

And i figured it out and it all worked.

Thanks again for your support

Userlevel 5
Badge +14

you haven't written you need it for choice control in last post, I have understood it you refer to your code and that you have problems with clearing text box.

beside of that I have posted how to set an (default) option of choice control in my very first post.

consider marking a post that answered your question as an answer.

Badge +11

Hello

I am trying to implement the above solution for my case. but I am not having much success.

I have a choiceControl of 4 options whereby each option offers another 4 options:

When Supplier is selected then there is another choiceControl named [SupplierReason] available.

Same applies for Customer and the rest of other options.

I like to apply so when a user switches between the option, it should RESET the values.

Example: a user selects supplier and then select Supplier 2 ... however, he changes his mind and then select Customer and select Customer 2 instead. In the mean time, the already selected entries are not reset and therefore remain in field.

I am failing to understand how to nest this together?

 [SupplierReason] has got 4 options and is shown when Supplier is selected.

 [CustomerReason] has got 4 options and is shown when Customer is selected

[FreightReason] is the main choice control (Supplier, Customer, Transport, Project, Internal).

Any help would be appreciated. happy.png

Badge +11

Anybody here can advise / help ... please?

Badge +11

I managed to find a solution.

Please refer to this link: https://support.nintex.com/SharePoint/Forms/Clearing_Values_from_Disabled_Choice_Control_with_JavaScript

In essence, I used this code to make it work

NWF$(document).ready(function()
{
var choice = NWF$("#" +FreightReason);
choice.change(function()
{
NWF$("#" + SupplierReason).find("input:radio").attr("checked",false);
NWF$("#" + CustomerReason).find("input:radio").attr("checked",false);
} );
} );

Reply