Changes

Passing Values Using Parameters

8 bytes removed, 17:39, 20 October 2017
no edit summary
Using several techniques , you can pass values a value (called a Parameter) from one page to another in order to pre-populate form fields or display on an HTML page.
==Sending Page==
Values can be sent from the initial (sending) page by creating a link to the destination page that includes parameters linking the variables to be passed. These are then parsed by the receiving page back into values.
'''Syntax:'''
:<font size="3">'''/urltopage?parameter1var1=@variable1@&parameter2var2=@variable2@'''</font>
'''Where:'''
* ''urltopage'' is the relative [[URL]] to the destination page.
* ''variable1'', ''variable2'' etc. are the variable names (ege.g. @firtsnamefirstname@).* ''parameter1var1'', ''parameter2var1'' corresponding names for the variables
'''Portal'''
* Create a [[Portal]] shortcut and associate the link with that shortcut.
/urltopage?parameter1var1=@variable1@&parameter2var2=@variable2@
<pre>
<input type="button" class=Button value="Button Label"
onClick='parent.location.href="/urltopage?parameter1var1=@variable1@&parameter2var2=@variable2@"'/>
</pre>
* Create a [[Custom Field Type: Read Only – System Variables|Read Only - System Variables]] Custom Field with:
<pre>
<a href="/urltopage?parameter1var1=@variable1@&parameter2var2=@variable2@">Click Here</a>
</pre>
var para2=document.getElementById('field2');
para1.value = unescape(params["parameter1var1"]);para2.value = unescape(params["parameter2var2"]);
var para2=document.getElementById('element2');
para1.value = unescape(params["parameter1var1"]);para2.value = unescape(params["parameter2var2"]);
</script>
Replace "field1" or "element1" etc. with the actual form or element id name and "parameter1var1" with the parameter name.
eg.
[[SmartSimple]] will replace the variable references (@lastname@ , etc.) with values derived from the current [[User|user]] session.
[[Category:System Management]][[Category:JavaScript]] ==See Also==* [[Category:Pass VariablesTo Level 1]]
Smartstaff, administrator
686
edits