Hi Sheridan,
This is possible using Rules in Nintex Forms. If you are using the Responsive type forms designer, you'll see where you can assign a 'Then' method of 'Set Value' to a control. In this scenario, it would be when a drop down (choice control) of titles has a particular value selected, then set a value of 'x' to the Single or Multi Line text control.
When you click on the control you wish to be populated with a dynamic value, click on 'Add Rule' in the designer ribbon and you'll see the Rules flyout appear.
You'll use the formula builder to then build a rule for the Named Control of the choice control with the stored titles. In this example, the Named Control is 'BusinessType'.
Thank you,
Sean
Sean,
Thank you for the quick and informative reply. Greatly appreciated, very helpful. Apologies for the ignorance, I am in the process of completing the learn.nintex.com classes as we speak.
So I've created a "Choice" control (Titlechoice) and input my selection options and created a text form control.
When I create a rule, I see the formula builder option etc. followed by the When and Then options.
Do I create the rule by selecting the Text control, add rule, then create a formula for when, and add the text I want to appear in the value? Or Do I create the rule using the Choice Control (Titlechoice) and follow the same steps?
Since there are 15 options in my Choice control, I am assuming that means I will need to create a rule for each one, 15?
I've performed the action you see in the image below. I selected the Named Controls under insert reference for the formula builder then used the == and typed one of my drop-down choices "Adding a Provider". I then selected "Set value" and typed in the text I wish to appear in the value. However, when I run a preview and make the selection, I do not see anything in the Text box.
Hi Sheridan,
Thank you for the reply! Looks like we have a bug with this functionality in Nintex Forms. I was able to reproduce the same error. I'll get the support team to create a ticket for it.
In the meantime, I've written up some JavaScript to achieve the same result in the Classic version of the form designer.
This custom JavaScript would be added to: Form Settings > Custom JavaScript
In this example, I have a choice control with three options: Car, Boat, Plane. The choice control will have a JavaScript variable ID of 'titleChoice'. I'll use the variable ID to use as the element to track when a change occurs to that control.
When a change occurs, the JavaScript will check the expression (output of the choice control), and then add a value to the Single Line Text control. The Single Line Text control has a JavaScript Variable ID of 'newText'.
NOTE: Don't place any spaces between your value and comma in the choice control 'Choices' field.
And here is some code to knock this out:
NWF$(document).ready(function () {
NWF$('#' + titleChoice).change(function () {
var x = NWF$('#' + titleChoice + " option:selected").val();
var y = NWF$('#' + newText);
switch (x) {
case "Car":
y.val("You have selected a car!");
break;
case "Boat":
y.val("You have selected a boat!");
break;
case "Plane":
y.val("You selected a plane!");
break;
default:
y.val("No selection has been made!");
}
});
});
Excellent. Thank you very much Sean. Is it possible to do this with multi-line text rather than single line? My goal is to have some predetermined text show up in the box, yet allow room for the user to fill in or add to the rest.
Hi Sheridan,
Yup, that should totally work with a Multi Line Text box too! The JavaScript Variable ID field will be located under Advanced, just like in the Single Line Text control.
Thank you,
Sean