cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Workflow Hero

Troubles connecting text field populated by JavaScript to list column

Jump to solution

I have a textbox that is populated by a Javascript function.  I want to connect that textbox to a column in my list and keep coming up blank. I've tinkered with the datatype in my list column (right now it's a number, but have tried currency and string). I've added a calculated value field whose formula is just the value of the textbox (so I could then connect the calculated value to the list column). I've tried to get something to work using a formatting rule. No dice on any of these. It seems I'm missing something obvious. Why would the list column care if the field is populated by JavaScript? 

My textbox properties:

Snippet of Javascript that populates txtTotalCost: 

NWF$('#'+jsTotalCost).val(totalCost);
0 Kudos
Reply
5 Replies
Workflow Hero

Re: Troubles connecting text field populated by JavaScript to list column

Jump to solution

your code should work for single line text.

have you checked totalCost variable is correctly populated beforehand? can you you see the value in a form after code is executed?

don't you have multiple controls connected to the same list field?

Reply
Workflow Hero

Re: Troubles connecting text field populated by JavaScript to list column

Jump to solution

Glue .focusout() after the val(). At least that works for me in all my JS.

Reply
Workflow Hero

Re: Troubles connecting text field populated by JavaScript to list column

Jump to solution

The problem is - I had the textbox enabled property set to False. This still allows JavaScript to populate the textbox but apparently disables the SharePoint field from the SharePoint list itself. I think this is absurd. So I enabled the textbox, moved it to the far bottom corner of the form and covered it with a multi line text box. The I put a calculated field in its place so the user can see the payroll deduct amount but can't edit it. 

0 Kudos
Reply
Workflow Hero

Re: Troubles connecting text field populated by JavaScript to list column

Jump to solution

If you intend to access a control on a Nintex Form using JS, then never use the control properties Enabled and Visible. Especially hiding the control by setting Visible to No no longer renders the control on the form and as such it can't be used in JS. In these cases I always use a formatting rule:

  • Disabled controls need to be temporarily enabled in JS, value set and disabled again.
  • Hided controls should also be temporarily shown, value changed and hidden again
Reply
Workflow Hero

Re: Troubles connecting text field populated by JavaScript to list column

Jump to solution

For anyone's reference, in my JavaScript I am now 1) populating the text box and 2) disabling it: 

NWF$('#'+jsTotalCost).val(totalCost);
NWF$('#'+jsTotalCost).prop('disabled',true);

0 Kudos
Reply