cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Not applicable

Assign value to Text box/Checkbox not working.

Hi,

I have Reset button on my Form and when user click on that, I need to reset all the control on the form. I have textbox,Choice, Dropdown list and Radio buttons on the form.I have tried below code to reset the form , but its not working. Could you please help me on this.

function ResetDefault() {

    NWF$("#" + RbtnServiceCodeExmpt).find('input[value=\'Yes\']').attr('checked', 'checked');

    NWF$("#" + RbtnRequirement).find('input[value=\'Select One:\']').attr('checked', 'true');

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

}

On the Reset button i have below code:

NWF$(document).ready(function () { ResetDefault(); });

Regards

Ranjith

0 Kudos
Reply
9 Replies
Highlighted
Automation Master
Automation Master

Re: Assign value to Text box/Checkbox not working.

On the reset button, you should only populate the following :

ResetDefault();

Can you try with this value in the "Client click" field of the reset button ?

Reply
Highlighted
Not applicable

Re: Assign value to Text box/Checkbox not working.

Thanks for your response,

I have tried your approach but its not working...

Thanks

Ranjith

0 Kudos
Reply
Highlighted
Automation Master
Automation Master

Re: Assign value to Text box/Checkbox not working.

Does it work for the textbox or not at all ?

0 Kudos
Reply
Highlighted
Not applicable

Re: Assign value to Text box/Checkbox not working.

No, its not working for any controls.

0 Kudos
Reply
Highlighted
Automation Master
Automation Master

Re: Assign value to Text box/Checkbox not working.

can you check with the debugger of your browser if the function is executed on the click on the button?

do you have javascript errors on the form ?

0 Kudos
Reply
Highlighted
Not applicable

Re: Assign value to Text box/Checkbox not working.

yes, checked that and the function is executing on the button click.

i have tested the same code on the form load to assign test data to the controls where its working fine. the issue only on the button/radio button change events.

please let me know thoughts on this?

Thanks

Ranjith

0 Kudos
Reply
Highlighted
Automation Master
Automation Master

Re: Assign value to Text box/Checkbox not working.

Do you mean that it works for the textbox but not for the radio buttons ?

For the radio buttons, do you want to select a particular value or no option should be selected ?

0 Kudos
Reply
Highlighted
Not applicable

Re: Assign value to Text box/Checkbox not working.

No, its works for all the controls( textbox,radio button, etc..) on the form load, but not on the button click.

0 Kudos
Reply
Highlighted
Automation Master
Automation Master

Re: Assign value to Text box/Checkbox not working.

That's weird, you execute the exact same function (the one you've shared) at the button click and at the loading of the form ?

After the form is loaded, is there a Javascript error ?

0 Kudos
Reply