AnsweredAssumed Answered

Setting a form field value based on choice value with Javascript

Question asked by darrentcs on May 3, 2016
Latest reply on Jun 8, 2017 by mmulherin@kellerschroeder.com

Hi all,

 

I am looking (on the press of a button) in a Nintex form to set the value of a Task Status field based on the value/selection of a choice field control (set as Option buttons).

 

Here is the set up.

 

I have a choice control field (not connected to any SharePoint field) in my form.

I have set display format to Option Buttons (only one should be selected)

I have two choices, values:

Start Query
End Query

Render as buttons = No

I have a variable in StoreClientID in JavaScript variable set to QueryOutcome.

I have a SharePoint Column called Task Status. This has values of:

Not Started
In Progress
Query
Completed.

 

 

 

I want to test the if and else of the javascript function to see if the code is retrieving the value of the choice field variable 'QueryOutcome' so I am using alert at the moment to see if all is working. However, it is only returning Stop Query Alert even when I select Start Query option on the form in the choice control. It appears the value of the choice control is not getting passed/retrieved.

My form button is of type Save and Submit and I have the following code under advanced/Client Click:

Eventually I want something in place of the alert command to set Item Property: Task Status == 'Query'

 

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

 

var Query = NWF$('#' + QueryOutcome);

 

if(Query == "Start Query"){

alert('Start Query Selected')

 

} else {

 

alert('Stop Query Selected')

}

 

  ;});

Outcomes