You could do:
Code:
<input id="chkr" name="colors" type="hidden" value="chkr">
If that isn't acceptable, the script and markup could be modified to:
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/javascript">
function valuate(){
var txt=''
var colors=document.getElementsByName('color')
for (var i_tem = 0; i_tem < colors.length; i_tem++)
if (colors[i_tem].checked)
txt+=' '+colors[i_tem].value
txt=txt.replace(/^ /, '')
document.forms['form1']['colors'].value=txt
}
</script>
</head>
<body>
<input type="checkbox" name="color" value="red" onclick="valuate()"><br>
<input type="checkbox" name="color" value="yellow" onclick="valuate()"><br>
<input type="checkbox" name="color" value="white" onclick="valuate()"><br>
<form name="form1" action="#">
<input name="colors" type="hidden" value="chkr">
<input type="submit" value="Go!">
</form>
</body>
</html>
However, no matter what you do, the value of the hidden input will be changed by the javascript. That's how forms pass data. If you are already using Perl, there may be a way to use it instead of javascript. That would be better as, it would not leave out non-javascript enabled browsers.
Bookmarks