We’ll need some more details. Are you using Classic, Responsive, or New Responsive forms?
Also I’d like to know a little more about what you’re trying to accomplish. I’ve posted before about how to update a Form Variable using js but it’s almost never something that I’ve ever needed to do in production. It will be helpful to understand your situations a little better.
Good evening,
Thanks for your feedback.
In fact I use a classic form as part of a tutorial which aims to perform a page switch in a form.
function goStep(stepNumber)
{
var hiddenTxtBox = NWF$("#"+hiddenTxtBoxId);
hiddenTxtBox.val(stepNumber);
NWF.FormFiller.Functions.ProcessOnChange(hiddenTxtBox);
}
The code above implies that the text field is used as a "hidden" element in order to be evaluated by a rule.
However it remains visible on the layout which is not very "clean" and I was wondering if it was possible to directly access a form variable?
the code he makes for goStep is only going to work at targeting a Form Control that has been assigned a JavaScript ID in the advanced settings. You’d need to change the function to look something like this:
function goStep(stepNumber)
{
var hiddenTxtBox = NWF$("(data-controlname='hiddenFormVar'] .nf-calculation-control-value");
hiddenTxtBox.val(stepNumber);
NWF.FormFiller.Functions.ProcessOnChange(hiddenTxtBox);
}
where the data-controlname equals the name of your Form Variable proper.
That should roughly make the function work.
It's top class !
Many thanks for your help, it works very well and is very clean as well.
Have a nice day