I've been working on some perl & HTML code, and it's been working fine, passing a value from its field, back into itself after submission. However, if the field ever gets disabled during the run, the value of the field seems to not get passed back as a parameter. Here's a simplified version of the code to demonstrate the problem:
use CGI::Carp qw(fatalsToBrowser warningsToBrowser);
my $cgi = CGI->new;
my $test1 = $cgi->param('test1');
$test1 *= 2 if $test1;
$disabled = "disabled" if ...some condition...;
Content-Type: text/html; charset=utf-8\n
<form method="post" name="main">
<input name="test1" value="$test1" $disabled>
<input type="submit" name="submit" value="Submit">
1. Why does the value not get passed when the field is disabled? (I don't get this problem if I use "readonly" for example, but I'm not keen on using readonly, for other reasons.)
2. How can I get around this (i.e. make it so the value is still passed when the control is disabled)?
3. By the way, when should I use 'disabled="disabled"' and when should I use just 'disabled'?