Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Resolved Syntax issue.

...

Access submission.metadata.Node from any Javascript rule to identify the current validation node as detailed in the example below.  

It is recommended that you use a Calculated Value Rule (found on the Data tab) of a hidden Text Component to  store this value.  You can then use Simple Conditionals to show or hide components based on that value.  Always remember to make sure Clear Values When Hidden when showing and hiding controls.  If this option is checked, any data elements in the control will be cleared when visibility changes.

Note - If the form doesn't exist it in a Validation Step on opening it (like when creating a new submission, it will present a javascript error).  The rule below outlines how to properly execute the rule, and default a value if the form is not in a validation node.

Code Block
languagejs
firstline1
titleValidation Step
linenumberstrue
try 
{
	if (submission.metadata.Node)
	{
		value = submission.metadata.Node;
	}
	else if (!submission.metadata.Node)
	{
		//Default value to set if not in validation node
		value = 'Submitted Form';
	}
}
catch(err)
{
	//Default value to set if not in validation node
	value = 'Submitted Form';
}