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

How to apply rules according to click on "draft button" or "submit button" ?

Jump to solution

Hi,

In the case where I have a forms with draft, I need to perform differents actions according to the click on draft or submit button.

In my case, I have various type of fields (text, multi line, dropdown list ...) with rules on it.

On the bottom of the form, I have repeating section with different type of field and rules on it.

So my goal is :

- When I click on "draft button", no rules have been applied.

- When I click on "submit button", all rules have been applied.

One rule to do this : I don't want to use Javascript (or the least possible)

If someone have a solution, thanks in advance.

Théo

0 Kudos
Reply
4 Replies
zaert
Nintex Newbie

Re: How to apply rules according to click on "draft button" or "submit button" ?

Jump to solution

I get back to you with a solution =) !

Requirement on your form :

4 buttons

2 Technical textbox

Javascript but really little for instance (four lines max.)

Explanation :

  • Configuration of the buttons
    • Add 2 buttons on your forms
      • First button correspond to draft functionnality
        • Name : HiddenDraft
        • Button action : Save
        • Button type : Button
        • Button label : Hidden draft
        • CSS class : hiddenDraft (in Formatting)
      • Second button correspond to submit functionnality
        • Name : HiddenSubmit
        • Button action : Save and Submit
        • Button type : Button
        • Button label : Hidden submit
        • CSS class : hiddenSubmit (in Formatting)
    • Add 2 others buttons on your forms
      • First button correspond to the draft button that will display for the users
        • Name : DisplayDraft
        • Button action : Javascript
        • Button type : Button
        • Button label : Draft
        • Client click : IsDraft() (in Advanced)
      • Second button correspond to the submit button that will display for the users
        • Name : DisplaySubmit
        • Button action : Javascript
        • Button type : button
        • Button label : Submit
        • Client click : IsNotDraft() (in Advanced)
  • Javascript functions

I don't want to explain how to set up Javascript into a Nintex forms because I think you have lots of tutorial on the forum so I start directly with the command.

In your javascript, add the previous function that you have on the button so here, it's like :

 

function IsDraft(){
     NWF$(".draftControl").val(0);
     NWF$(".hiddenDraft").click();
 }
 function IsNotDraft (){
     NWF$(".draftControl").val(1);
     NWF$(".hiddenSubmit").click();
 }

  • Configuration of the textbox (add 2 textbox on your form)
    • First textbox
      • Name : IsNotDraft
      • Default value = 0
      • Control CSS class : draftControl
    • Second textbox
      • Name : ForcedValidation
      • Default value = 0

So, now that all elements are set up and OK, we will set up some rules.

Actually, I place my rules on control which are in repeating section like the following :

Add rule type validation and adapt the following rule. Replace bold and underligned word by your own rules. Don't forget to re-import your own named control.

I don't have time to explain more for now but if you need more detail, don't hesitate to publish your questions on that post.

If(equals(IsNotDraft,1),or(isNullOrEmpty({Self}),equals({Self},"--")),equals(ForcedValidation,1))

Théo

Reply
harfmt
Nintex Newbie

Re: How to apply rules according to click on "draft button" or "submit button" ?

Jump to solution

Hi Theo

This seems to apply to fields that are not required sharepoint columns. I'm guessing there is not a way to get the Draft to ignore required sharepoint fields? And so all validation must be set in the form and not on the list. I have many required sharpoint columns that I'd like to ignore with one rule in the form. 

Thanks

Joanne

0 Kudos
Reply
michael_campbel
Nintex Newbie

Re: How to apply rules according to click on "draft button" or "submit button" ?

Jump to solution

Thanks for this solution Theo, it may require me to do some additional work, but this works perfectly. 

Reply
zaert
Nintex Newbie

Re: How to apply rules according to click on "draft button" or "submit button" ?

Jump to solution

Hi Joanne,

Sorry for the delay. Yes, indeed I forget to check this parameter.

I haven't access to my forms anymore but if I supposed yes that you can't by-pass sharepoint fields parameter.

One way to know, basic test on one field just to be sure.

BR

Théo

0 Kudos
Reply