Forum Moderators: open
function GetSelect (form) {
alert("got here");
alert(Item);
Item = Add.VARname.selectedIndex;
Result = Add.VARname.options[Item].text;
Result2 = Add.VARname.options[Item].value;
T = Add.VARname.options[Item].text;
T2 = Add.VARname.options[Item].value;
fillform()
I get the first alert, the alert for "Item" shows up, but its empty (NULL?). So the browsers don't seem to like my Item = Add.VARname.selectedIndex statement. If I move the Item alert below the "Item =" line, I get nothing, no alert, nada. Looks to me like thats where its breaking.
You should be using document.getElementByID
My functions seem to be using this. In part:
document.getElementById("AddSubmit").disabled = false;}
and
document.getElementById("AddSubmit").disabled = true;
But those lines simply control whether my Add To Cart button is or is not active.
What are 'Add' and 'VARname'
Add is the name of my form: <form name="Add">
VARname is my select name: <select name="VARname" size="1">
I tried to validate this page yesterday with Transitional standards, and the form was one of the problems that cropped up, because there was no method. The form contains my selections, 2 buttons (one to add items from the options list, the other to clear the selections. Finally it has 4 text boxes to display items selected.
My Add to Cart button is disabled until 4 items are picked.
<input src="/images/addbotton.gif" name="AddSubmit" type="image" align="middle" style="width:58;height:20;border:0" disabled="TRUE" onClick="SubmitSelect()">
I'm counting the items as they are picked with (var i=1;), and my fillform() function has this line to enable the "AddSubmit"
{if (i == 4) document.Add.T4.value = T; TArray[3] = T; TArray2[3] = T2; ++i;
document.getElementById("AddSubmit").disabled = false; }
"AddSubmit" never gets its state modified, it remains disabled. I tried substituting document. with form. and false with 0. I tried UPPER CASE and lower case, I tried "quotes" and no quotes. The ugly button just sits there defying my efforts.
<input src="/images/addbotton.gif" name="AddSubmit" type="image" align="middle" style="width:58;height:20;border:0" disabled="TRUE" onClick="SubmitSelect()">
I re-wrote that line to read , in part:
<input name="AddSubmit" id="Addsubmit" ... not sure yet if the id played a role, or just because I moved the name.