in reply to populating a textarea

..and the verdict is... both previous posters are correct. There are two problems with your code: 1) You have two form fields, which means that when you press "Insert:" you only get the form fields in form1, when you press "Save" you only get the form fields in form2. Make them one form and you're almost there.

Problem #2 is that, yes, indeed, CGI is making your data sticky, meaning it will ignore the value you're trying to create for SPCtext because SPCtext already has a value of the empty string. Sometimes this a good thing. In my experience it's a pain in the butt. Fortunately, fixing it is as simple as adding a "force=>1" parameter to your textarea line, like so:

print $query->textarea(-name=>'SPCtext', -cols=>50, -rows=>10, -value= +>$testText, -force=>1);
In short, this code is tested and works:
#!/usr/bin/perl -w use CGI; $query = new CGI; print $query->header; print $query->start_html(); print $query->start_multipart_form("POST", "test.pl"); print "Field Name:"; print $query->textfield(-name=>'FieldOne', -size=>25); print "Field Type:"; print $query->textfield(-name=>'FieldTwo', -size=>25); print "Field Length:"; print $query->textfield(-name=>'FieldThree', -size=>25); print "<br>" . $query->submit('Insert Field'); $testText = $query->param('SPCtext') . $query->param('FieldOne') . $qu +ery->param('FieldTwo') . $query->param('FieldThree'); print $query->textarea(-name=>'SPCtext', -cols=>50, -rows=>10, -value= +>$testText, -force=>1); print $query->submit('Save'); print $query->endform(); print $query->end_html();

Gary Blackburn
Trained Killer

Replies are listed 'Best First'.
Re: Re: populating a textarea
by amulcahy (Acolyte) on Nov 09, 2001 at 18:45 UTC
    woohoo!!!!!!

    Thanks 'Killer' - Friday 13:40, you've done my work for me, looks like I can go home now.