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

Auto populate value in drop-down menu

Jump to solution

Hi

I want to auto-select field values based on values elsewhere in the form.

============================

Example:

Drop-down menu A: Creature

Choices: Man, Dog, Spider

Drop-down menu B: Species

Choices: Human, Canine, Arachnid

When a user selects Man in menu A,  menu B auto-populates as Human. 

When a user selects Dog in menu A,  menu B auto-populates as Canine. 

When a user selects Spider in menu A,  menu B auto-populates as Arachnid. 

=============================

These menu choices are not based on lookups of other lists. Using lookup lists is not practical for us. We need our forms in one list without the requirement of maintaining supporting lists.

I understand that InfoPath allows this functionality quite easily, but can't seem to find something similar in Nintex Forms.

I don't mind using JavaScript, just not sure if this can be done without in the latest version or how I would go about doing it. 

Appreciate any help that can be offered.

Platform: Nintex Forms 2013 2.10.1.0

Environment SharePoint 2013 Enterprise

Labels: (3)
Reply
16 Replies
courtney_shelto
Nintex Newbie

Re: Auto populate value in drop-down menu

Jump to solution
0 Kudos
Reply
emha
Nintex Newbie

Re: Auto populate value in drop-down menu

Jump to solution

here is very similar case -  

0 Kudos
Reply
harryr
Nintex Newbie

Re: Auto populate value in drop-down menu

Jump to solution

Thanks for the links but they don't really answer my question. I don't want to auto populate fields when the form is opened. I want to create a link between values in two drop-down menus. Selecting one value in menu A changes the value in menu B, dynamically, while the form is open.

0 Kudos
Reply
courtney_shelto
Nintex Newbie

Re: Auto populate value in drop-down menu

Jump to solution

Hi Harry,

Marian's link goes specifically into how to modify the value of one field with the event being the change of another. The two links I provided give more details on how to set a dropdown field using Javascript. You can use both of these to create the solution you're looking for. 

You can also check out this resource: How to Create Cascading Choice Controls – Nintex Forms  from

Reply
emha
Nintex Newbie

Re: Auto populate value in drop-down menu

Jump to solution

here is the script which (re)sets value of dropdown control (choice) based on value of other dropdown control (choice as well).

second control follows each change of the first one. if first control is set to a value out of defined list, second control is cleared.

jsDDA_Creature and jsDDB_Species are javascript variables configured for respective controls.

the script should be placed into form settings >> Custom JavaSript

NWF.FormFiller.Events.RegisterAfterReady(function () {  
    NWF$('#'+jsDDA_Creature).change(function(evt){
        switch(evt.target.value){
            case 'Man' :
                NWF$('#'+jsDDB_Species).val('Human');
                break;
            case 'Dog':
                NWF$('#'+jsDDB_Species).val('Canine');
                break;
            case 'Spider':
                NWF$('#'+jsDDB_Species).val('Arachnid');
                break;
            default:
                //no creature
                NWF$('#'+jsDDB_Species).val('');
                break;
         }
    })
})
‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

choice‌ dropdown‌ choice dropdown dropdown choice set dropdown value by other dropdown set choice value by other choice populate dropdown populate choice

Reply
harryr
Nintex Newbie

Re: Auto populate value in drop-down menu

Jump to solution

Thank you very much for your effort Marian but I can't get that to work. The values are not changing.

I put the script in the form settings custom Javascript section and gave the drop-down menus variable names in their respective settings (store client id in javascript variable). 

Am I missing something else?

0 Kudos
Reply
emha
Nintex Newbie

Re: Auto populate value in drop-down menu

Jump to solution

can you check developer console for any errors?

press F12 in browser, in window that opens switch to 'Console' tab, return to browser and run the form. watch dev console whether there are not any errors reported.

0 Kudos
Reply
harryr
Nintex Newbie

Re: Auto populate value in drop-down menu

Jump to solution

I checked it yes and it said jsDDA_Creature is undefined.

I can't tell what's nintex wrap code and what's not.  Is the jsDDA and jsDDB some type of Nintex code or wrapper or just an example variable name that I can change?

Reply
harryr
Nintex Newbie

Re: Auto populate value in drop-down menu

Jump to solution

OK it's working after I added the jsDDA and jsDDB to the respective control names. 

Many thanks for your help on this. Apologies I 'm such an amateur at JS. Hopefully I can improve soon but getting to the level above may take some time 

Reply