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

How to disable a button in Nintex Forms using Scripts ?

Basically, I have a Nintex Form, where based on the Status, the buttons at the bottom of the form changes. For example if the Status is "In Review" then only the Approve & reject Buttons are shown. The problem I am facing is - there is a field "Reviewer`s Notes" which must be filled before "Rejecting". So I need added validation where if Reviewers Notes is empty then Disable the Reject button. Once user has filled it up then the Reject button should be dynamically enabled. Hence I need the scripting solution and not the validation / Rules counterpart.

What I have tried is using

NWF$('.nf-save-button').removeAttr("disabled", "disabled");

But this is a class specifier and it is affecting all the Save buttons. I need to specifically disable the  Reject button. I have also tried to get the ID of the Reject button from the DOM use it like this. This also didnt work.

Check Button ID: ListForm_formFiller_FormView_ctl90_ed7c8a8f_dbac_436c_98ae_d32e3c9a3dc6 
NWF$("#ListForm_formFiller_FormView_ctl90_ed7c8a8f_dbac_436c_98ae_d32e3c9a3dc6").prop('disabled',true); 
NWF$("#ListForm_formFiller_FormView_ctl90_ed7c8a8f_dbac_436c_98ae_d32e3c9a3dc6").removeAttr("disabled", "disabled");

 

Thanks for any help in advance. Also please let me know if I need to provide any more information.Capture2.PNGCapture.PNG

 

Labels: (1)
0 Kudos
Reply
4 Replies
Highlighted
Nintex Newbie

Re: How to disable a button in Nintex Forms using Scripts ?

Your code is touching all buttons because a save/submit button is the same regardless of how many times you replicate it.

 

With the new responsive designer for O365 you should be able to set a simple rule for this. Let me know if you are able to get this done.

0 Kudos
Reply
Highlighted
Nintex Newbie

Re: How to disable a button in Nintex Forms using Scripts ?

You can assign CSS class to specific buttons you want to disable/enable. Select button on form, go to properties /more settings and under formatting section you can set assign CSS class.

Now in script you can use that class/es for button/s instead of generic classes ( nf-save-button etc. which are applied to all the similar type of buttons).

You can use this CSS way to manipulate all the controls very similar to any html form though it works only in classic form.

If any confusion with code let me know.

 

Reply
Highlighted
Nintex Newbie

Re: How to disable a button in Nintex Forms using Scripts ?


@bluezzz1 wrote:

Basically, I have a Nintex Form, where based on the Status, the buttons at the bottom of the form changes. For example if the Status is "In Review" then only the Approve & reject Buttons are shown. The problem I am facing is - there is a field "Reviewer`s Notes" which must be filled before "Rejecting". So I need added validation where if Reviewers Notes is empty then Disable the Reject button. Once user has filled walmart wire then the Reject button should be dynamically enabled. Hence I need the scripting solution and not the validation / Rules counterpart.

What I have tried is using

NWF$('.nf-save-button').removeAttr("disabled", "disabled");

But this is a class specifier and it is affecting all the Save buttons. I need to specifically disable the  Reject button. I have also tried to get the ID of the Reject button from the DOM use it like this. This also didnt work.

Check Button ID: ListForm_formFiller_FormView_ctl90_ed7c8a8f_dbac_436c_98ae_d32e3c9a3dc6 
NWF$("#ListForm_formFiller_FormView_ctl90_ed7c8a8f_dbac_436c_98ae_d32e3c9a3dc6").prop('disabled',true); 
NWF$("#ListForm_formFiller_FormView_ctl90_ed7c8a8f_dbac_436c_98ae_d32e3c9a3dc6").removeAttr("disabled", "disabled");

 

Thanks for any help in advance. Also please let me know if I need to provide any more information.Capture2.PNGCapture.PNG

 


I could get it done with O365 as eharris04 said.

0 Kudos
Reply
Highlighted
Nintex Newbie

Re: How to disable a button in Nintex Forms using Scripts ?

Why do you need to do that with script and not rules ?

This could be done with some formatting rules.

 

We could imagine :

-Add One panel on your forms.

-This panel contains Approve&reject Buttons.

-This panel has a rule which hide if the status is not "In review"

-On the button reject, add a formatting rule who disable the button if : The Status = "In Review" AND if the control "Reviewer's Notes" is empty

 

-And the icing on the cake, in your pan, add a label with message "You must fill the Reviewer's note if you want to reject" and add a rule on it which : Hide if : Status = "In Review" AND if the control "Reviewer's Notes" is not empty

Reply