..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


In reply to Re: populating a textarea by Trimbach
in thread populating a textarea by amulcahy

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.