Display content in multi-line field (text)

  • 7 January 2016
  • 2 replies
  • 6 views

Badge +4

I have a requirement to display content into a multi-line field (Plain text) in real-time, based on end user selection in a look-up field “drop-down”. I’m able to pull the content by using the look-up functionality in a calculated value expression. I’d like the ability to copy the calculated value over to multi-line field.   Is there a way within Nintex to copy content from calculate value into the multi-line?

 

Any help on this will be appreciated.

 

Rene


2 replies

Badge +6

You need to use JavaScript/JQuery to get the change on your dropdown and copy to another field.

In your dropdown, declare in the field settings a "Client ID JavaScript variable name" and in your form setting, put the treatment about the change of your dropdown based on the client ID.

Badge +7

Hi Rene,

François THOMAS is right, you need JavaScript to get what you want.

But as you want a lookup content, it may be tricky to write the code if you don't know JS well.

Here's a way to achieve your goal.

Add a CSS class "lookup-selector" on the SharePoint Lookup control in your form.

163502_pastedImage_5.png

Add another CSS class "lookup-content" on the multi-line control in your form.

163503_pastedImage_6.png

Then, adapt the following code with the right field and list names and add it in the custom JavaScript section of the form settings.

NWF.FormFiller.Events.RegisterAfterReady(function ()

{

  NWF$(".lookup-selector select").bind("change",function()

  {

  var clientContext = new SP.ClientContext.get_current();

  var oList = clientContext.get_web().get_lists().getByTitle("ReneLookupList");

  var camlQuery = new SP.CamlQuery();

  camlQuery.set_viewXml('<View><Query><Where><Eq><FieldRef Name="ID"/><Value Type="Integer">'+$(this).val()+'</Value></Eq></Where></Query></View>');

  var matchingItems = oList.getItems(camlQuery);

  clientContext.load(matchingItems, "Include(MultipleLineField)");

  clientContext.executeQueryAsync(

  Function.createDelegate(this, function ()

  {

  if (matchingItems.get_count() > 0)

  {

  var matchingItem = matchingItems.getItemAtIndex(0);

  $textarea = NWF$(".lookup-content textarea");

  $textarea.val(matchingItem.get_item("MultipleLineField"));

  }

  }),

  Function.createDelegate(this, function ()

  {

  console.log('error loading data from ' + "ReneLookupList");

  })

  );

  });

});

Reply