MCS has asked for the wisdom of the Perl Monks concerning the following question:
I am trying to write a CGI front end to a database for recipes... I have a lot of it working but I am having trouble with my edit recipe form. The bit that is causing me problems is this:
for (my $i=0; $i<$numberofingredients; $i++) { print "$ingredientAoH[$i]{qty}\n"; print "Qty:", $query->textfield(-name=>"qty$ingredientAoH[$i]{ +ingID}", -default=>"$ingredientAoH[$i]{ +qty}" -size=>'10', -maxlength=>'20', "\n"); print "Amt:", $query->textfield(-name=> "ammount$ingredientAoH +[$i]{ingID}", -default=> "$ingredientAoH[$i] +{amt}", -size=>10, -maxlength=>100, "\n"); print "Des:", $query->textfield(-name=> "description$ingredien +tAoH[$i]{ingID}", -default=> "$ingredientAoH[$i] +{des}", -size=>50, -maxlength=>100), "\n"; print $query->hidden(-name=>"ingID$ingredientAoH[$i]{ingID}", +-default=>"$ingredientAoH[$i]{ingID}"), "<br>\n"; }
Now I put that extra print in there at the top for debugging purposes and it does in fact print out the correct value. However, the actual text field just displays the first whole number. So if I have a value of say 1/4, it just shows up as 1, 1 1/2 shows up as 1, etc... Larger numbers work (ie. 12 shows up as 12) but it doesn't seem to like spaces or slashes. Does anyone know why and what I could do to fix it?
Oh and as an aside, if I type in the correct value and submit it, the correct values go into the database. It just doesn't read them properly as the default values.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: problem with form value (using cgi.pm)
by Zaxo (Archbishop) on Feb 16, 2004 at 04:43 UTC | |
by MCS (Monk) on Feb 16, 2004 at 13:38 UTC | |
Re: problem with form value (using cgi.pm)
by Trimbach (Curate) on Feb 16, 2004 at 05:40 UTC | |
by MCS (Monk) on Feb 16, 2004 at 13:30 UTC | |
by Trimbach (Curate) on Feb 16, 2004 at 14:13 UTC | |
by MCS (Monk) on Feb 16, 2004 at 14:40 UTC |