Handling Querystrings with Javascript

Hi,

This post involves an issue I’m experiencing with handling querystring values after a radio button has been checked.

I can capture and parse a multi-parameter querystring and place those values into form fields upon arriving at a certain simple HTML/Javascript only web page, no problem.

It’s when a certain radio button is clicked after the page has loaded that I need to place another querystring parameter’s value into a form field.

I’ve attempted to replace a form field’s value by using an onclick event in the said radio button. The javascript function being called is in an external js file (linked in the head element of the html page) and is seen below:


function setINDBOTTUID() {
var textListKOID = document.qdbform.elements('_fid_302');
var textListUID = document.qdbform.elements('_fid_17');
var textListEmail = document.qdbform.elements('_fid_16');
var radListINDBOTT = document.getElementsByName('_fid_23');
if (textListUID=="") { 
	if ((textListKOID.value=="") && (radListINDBOTT[2].checked==true)) {
		textListUID.value = textListEmail;
}}}

In the radio button element, I have the following onclick event code:


onClick="setINDBOTTUID();"

What I’m expecting to ultimately happen when all conditions are true: When the radio button is clicked, I want the value in textListEmail to be copied to textListUID and the form field _fid_17 will contain what is in textListUID.

I would expect the see the form field _fid_17 abruptly populate with this value, but it is not doing so.

I may have a misunderstanding of how this should all take place, but I do successfully write null values to form fields in the same manner.

Any help is appreciated,
Chris

The snippet of code for the called function should have been written as you see it below.

function setINDBOTTUID() {
var textListKOID = document.qdbform.elements('_fid_302');
var textListUID = document.qdbform.elements('_fid_17');
var textListEmail = document.qdbform.elements('_fid_16');
if (textListKOID.value!="") { 
	if(textListUID.value=="") textListUID.value= textListEmail.value;
	}
}

The mistake I made was in checking the condition of a radio button field:

if ((textListKOID.value=="") && (radListINDBOTT[2].checked==true))

Since the fuction is called only when radListINDBOTT[2] was clicked, it made no sense to check for it. That, and the syntax was wrong anyway.