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

Syntax for Calculated Value Control in Form

Jump to solution

In my form, I have control A configured as a dropdown, getting its options from my SharePoint list.  I have control B configured as a calculated value.  I want the value selected from dropdown control A to determine what is automatically provided in calculated value control B.  I thought I wanted to use the startsWith function, but I'm not sure.  For example, if the value selected in A is "papaya" or "peach" (starts with a "p"), I want the value calculated in B to be "Smith."  If the value selected in A is "grapes" or "guava" (starts with a "g"), I want the value calculated in B to be "Jones."  What is the correct control, function and syntax for what I want to do?  I am using Nintex Forms 2013 with SharePoint 2013 on prem.

Labels: (3)
Reply
2 Replies
Workflow Hero

Re: Syntax for Calculated Value Control in Form

Jump to solution

Hi Sarah,

In Javascript, you can do something like this

where

ddlSelection is the Store Client ID in JavaScript variable of your selection control

ddlTitle is the Store Client ID in JavaScript variable of your field

valueChanged() is a Javascript function in which you can add your rule.

Put this Javascript code in Form Settings - Custom JavaScript

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

NWF$("#"+ddlSelection).change(function()

{

  var selectedValue = NWF$('#' + ddlSelection + ' option:selected');

  //Put your rule here and set the result in myValue

  //Fill the field

  NWF$("#"+txtField).val(myValue);

});

});

Regards,

Christophe

0 Kudos
Reply
Workflow Hero

Re: Syntax for Calculated Value Control in Form

Jump to solution

Hi Sarah

You can use the following formula:

result is e.g.:

The left control is the Calculated value control with the formula, the right is a Calculated value control with formula 'lookup' where lookup is the name of the list lookup control.

Kind regards

Manfred

Reply