Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need some help on this...

Status
Not open for further replies.

Kijori

Technical User
Jan 22, 2002
67
SG
i need to provide values to hidden fields based on what is selected.

<script language=&quot;Javascript&quot;>
function doSubmit() {
var element;
var form = document.myform;
if (form.C1.checked)
addTF(&quot;item1&quot;, &quot;cat1&quot;);
if (form.C2.checked)
addTF(&quot;item2&quot;, &quot;cat2&quot;);
if (form.C3.checked)
addTF(&quot;item3&quot;, &quot;cat3&quot;);
form.submit();
}

function addTF(x, y){
html = document.getElementsByTagName('DIV')[0].innerHTML;
document.getElementsByTagName('DIV')[0].innerHTML = html+&quot;<input type='hidden' name='menu' value='x'><input type='hidden' name='cat' value='y'><br>&quot;;
}
</script>

my problem. when i call the cgi script... i get x and y as values. how do i get the value field to accept item1, item2, cat1, cat2 and so on?
 
I would create the hidden fields as part of the html then populate the field in code.
ex:
document.[formname].menu.value = 'blah'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top