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:

http://myemaildomain.com/sales-letter/?contactId=109177&inf_contact_key=7b16576e806185cab224&inf_field_FirstName=Jill&inf_field_LastName=Dane&inf_field_Email=jill.dane%40myemaildomain.com&inf_3HmEAEiaKAqKJQDO=

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

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

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

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

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.)

HTH

:slight_smile:

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