Skip to main content

Hi!

I would like to know how to use the “Store Client ID in JavaScript variable” at Choice control for put the ID of the user that selects de option into a label control.

Hi Merildo,

 

So If you have configured Store Client ID in JavaScript variable” to "Yes", you can define one variable name and you can access that variable into your custom javascript. It will help you to access choice control into your javascript by using - document.getElementById(variablename). So When you write javascript, you can access the value from choicecontrol.

 

Now in order to show selected value from choice control, you have 2  options.

1. You can use Calculated control and set it's formula to choice control name

2. Use custom javascript and access choice control and label control by using  Store Client ID in JavaScript variable”  and set the value.

 

Let me know if any questions.

 

Regards,

Shirin


Hi, Shirin

I used the first one option

Thank you


Hi,

How I can show the value of this Client ID in JavaScript variable in (((lable)))???


Hi,

You can do following ways.

  1. Set one empty css class. e.g. - test-class.
  2. Add label and open settings. Set Formatting >> CSS class - test-class.
  3. Open Form Settings >> Custom Javascript and add following script.

NWF.FormFiller.Events.RegisterAfterReady(function ()
{

NWF$('#' + userChoiceCtrl).change(function(){
var selectedText = NWF$('#' + userChoiceCtrl + ' option:selected').text();
NWF$('.test-class').find('span').text(selectedText);
});
});

I have attached exported form. You can import and run it.

Let me know if any issues.


hi ,

 

thanks a lot your page help me a lot to showing calculated value in textbox box by using Client ID in JavaScript variable . its working fine . but I noticed something when I use (IF condition ) for this textbox , IF condition not working correctly with this textbox . do u know why ???


Hi,

Can you please send me your form or code so I can look at that? 


Sure but how I can upload form here ??


When you replying in editor, go to advanced editor mode and there should be attachment option at the bottom left side. 


Reply