Url Parameters into Input field on form

Quick clarity please on an older and now closed discussion. I am new to javascript - so my apologies in advance. Below is an excerpt from the old discussion - it seems like a simple solution to my problem. I just don’t get the inferences to ’ rdr ’ and other example code.

So here would be the actual url I would be needing the email address from - starting at the beginning of the parameters:


and the actual input line in the form:

input class="infusion-field-input-container" id="inf_field_Email" name="inf_field_Email" type="text" 

Can you help.

Excerpt from previous discussion:
*Example using #1 above

document.write('<INPUT type=hidden value=https://www.blahblah.com/info.html?variable='+var1+' name=rdr>');

The above examples assumes that var1 is global.
Example using #2 above

function setHidden()
	document.forms[0].rdr.value += '?variable=' + var1;
	return true;
<form onSubmit="return setHidden()">
<INPUT type=hidden value=https://www.blahblah.com/info.html name=rdr>

Again, this example assumes var1 is global*

Never use document.write. So, ignore #1.

Your input attributes need quotations. (type=“hidden” name=“rdr”)

Your #2 is a function that is called when the form is being submit.

document.forms[0] is using an index to refer to a form object (position 0 = first form.) Best to give the form an ID and use that (document.forms[‘formID’]).

document.forms[0].rdr is the INPUT; .value means the content of the input. So it’s saying "The value of input ‘rdr’ is going to be itself PLUS ?variable= and whatever var1 value is. The return true means “go ahead and submit the form” (return false would prevent the form from submitting.)



This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.