Skip to main content
Nintex Community Menu Bar
Solved

How to set a multi line text box based on drop down (when in use)

  • February 1, 2017
  • 5 replies
  • 110 views

Forum|alt.badge.img+8

All,

On my form (Nintex 2013)

I have a list lookup control connected to a separate list within my site.

This list has 2 columns: title and description. The list lookup shows the title values.

I have a multi line text box.

If a value is selected from the list lookup control how can the multi line text box be populated with the description field data and still be editable?

If list lookup control value is not selected the multi line text box will still be used, just not prepopulated.

 

I'm wanting to do this without a workflow as the end users will select a value from the lookup list and then want to start writing in the multi line text box.


Thanks

Andrew

Best answer by emha

so you probably might want to start with something what is provided OOTB without scripting...

anyway, so that you could learn anything new today (), proceed with the following

- copy the script provided and paste it into forms settings/Custom Javascript

- configure javascript variable of your lookup control to varLkp (you will find the settings in Advanced section at about very end of control's setting dialog)

- configure javascript variable of your text box control to varMLTB

5 replies

Forum|alt.badge.img+14
  • Scholar
  • February 1, 2017

eg. following easy way

it will append description related to selected lookup entry to textbox content

NWF.FormFiller.Events.RegisterAfterReady(function() {   
  NWF$('#'+varLkp).change(function(){
     var lkpSelection =  NWF$(this).val();
     var lkpID = lkpSelection.match(new RegExp(SPClientTemplates.Utility.UserLookupDelimitString)) ? NWF.RuntimeFunctions.parseLookup(lkpSelection,false) : lkpSelection;
     NWF.RuntimeFunctions.SPLookup('testlist','ID',lkpID,'description').done(function(data){
        var currContent = NWF$('#'+varMLTB).val();
        if (data.length){
           NWF$('#'+varMLTB).val(currContent + (currContent.length ? ' ' : '') + data);             
        }
     })
  })
})
‍‍‍‍‍‍‍‍‍‍‍‍

Forum|alt.badge.img+8

Thanks, but I have no idea what this is or where it goes. V. new to Nintex Forms.


Forum|alt.badge.img+14
  • Scholar
  • Answer
  • February 1, 2017

so you probably might want to start with something what is provided OOTB without scripting...

anyway, so that you could learn anything new today (), proceed with the following

- copy the script provided and paste it into forms settings/Custom Javascript

- configure javascript variable of your lookup control to varLkp (you will find the settings in Advanced section at about very end of control's setting dialog)

- configure javascript variable of your text box control to varMLTB


Forum|alt.badge.img+8

Marian,

Brilliant, thanks, attempting to do OOTB. Yet, will play with the JavaScript as well.


Love the learning.

Thanks

A


Forum|alt.badge.img+7
  • January 15, 2021

Not having any luck with this. I'm on 2013 On Prem.

 

Wonder if you can help?

 

This is my your code adjusted for my List...

 

NWF.FormFiller.Events.RegisterAfterReady(function(){NWF$('#'+varLkp).change(function(){var lkpSelection=NWF$(this).val();var lkpID = lkpSelection.match(new RegExp(SPClientTemplates.Utility.UserLookupDelimitString)) ? NWF.RuntimeFunctions.parseLookup(lkpSelection,false) : lkpSelection; NWF.RuntimeFunctions.SPLookup('Appraisals - Lookups','ID',lkpID,'description').done(function(data){var currContent = NWF$('#'+varMLTB).val(); if (data.length){NWF$('#'+varMLTB).val(currContent + (currContent.length ? ' ' : '') + data);}})})})

 

Nothing happens once I select from my drop down.