create 3 arrays. first array last names, second name first name and third array has asked for the wisdom of the Perl Monks concerning the following question:

I'm writing a messageboard system using perl(now w/CGI.pm) and am having a bit of trouble getting the default value of a textarea to do what i'm trying to get it to do. what i've got is
print $cgi->start_td({valign=>'TOP'}), "Message: ", $cgi->end_td, $cgi->start_td, $cgi->textarea({name=>'MESSAGE', wrap=>'SOFT', r +ows=>24, cols=>80, tabindex=>3, -default= +>"On $date, $from wrote:\n$message"}),
This doesn't do it, all it outputs is $message so I tried throwing it all into $replytxt and then doing this
$replytxt = "On $date $from wrote $message"; print $cgi->start_td({valign=>'TOP'}), "Message: ", $cgi->end_td, $cgi->start_td, $cgi->textarea({name=>'MESSAGE', wrap=>'SOFT', r +ows=>24, cols=>80, tabindex=>3, -default= +>$replytxt}),
same thing, I think it has something to do with that string, but i'm not sure. I've also tried using qw and single quotes instead of double, same results any ideas?

Replies are listed 'Best First'.
Re: default values of textareas using CGI.pm
by merlyn (Sage) on Mar 09, 2001 at 20:48 UTC
    Is this in response to a previous form invocation, and was there a field named MESSAGE in the form being submitted? If so, read up on "sticky fields", which are normally a blessing, but occasionally a distraction for tasks like yours. Here's the part of the doc you should focus on:
    Another note The default values that you specify for the forms are only used the first time the script is invoked (when there is no query string). On subsequent invoca- tions of the script (when there is a query string), the former values are used even if they are blank. If you want to change the value of a field from its previ- ous value, you have two choices: (1) call the param() method to set it. (2) use the -override (alias -force) parameter (a new fea- ture in version 2.15). This forces the default value to be used, regardless of the previous value: print $query->textfield(-name=>'field_name', -default=>'starting value', -override=>1, -size=>50, -maxlength=>80);

    -- Randal L. Schwartz, Perl hacker

      oh man yeah that was it, in fact I had just finished setting it up so that instead of that info being passed through CGI params its grabbed from a DB, so I was actually uselessly posting that info to the script, strange stuff