Entry
Can I post data from disabled text boxes , please suggest a way out.
Nov 12th, 2002 13:45
Alex Ginzburg, Rajeev Pai,
A quick way to get this done is by having hidden fields in the body of
your html page...
so it would go something like this.
<input type='text' name='text1' value='Some Data'> ----- Disabled Field
<input type='hidden' name='text1'> ------- Hidden Field
When you submit the form with the disabled fields, intercept that and
transfer all the entries into the hidden fields, and then submit that.
Example:
<html>
<head>
<script language='Javascript'>
function disableIt(){
document.formA.text1.disabled = true;
document.formA.text2.disabled = true;
}
function switchIt(){
document.formB.text1.value = document.formA.text1.value;
document.formB.text2.value = document.formA.text2.value;
document.formB.submit();
}
</script>
</head>
<body onload='disableIt()';>
<form name='formA'>
<input type='text' name='text1' value='Data1'>
<br>
<input type='text' name='text2' value='Data2'>
<br>
<input type='button' value='Submit' onclick='switchIt();'>
</form>
<form name='formB' method='POST' action='http://www.yoursite.com'>
<input type='hidden' name='text1'>
<input type='hidden' name='text2'>
</form>
</body>
</html>