Hello all,

What I want to do is create a form which has three textfields and one "Insert Fields" button. When the button is clicked the three values should be displayed in a textarea below it.
Okay, that bit I can do. The only complication is that after the first click I would like all subsequent clicks to append to the textarea and not replace the current values. I can manage to do it the first time but each subsequent click overwrites the existing textarea.
e.g.
1st time: Fields 1,2,3 = a,b,c (Click Insert) textarea = abc 2nd time: Fields 1,2,3 = x,y,z (Click Insert) textarea = abcxyz
that is what I would like it to do, but what I actually get is textarea = xyz. Here's my code.....
print $query->start_multipart_form("POST", "test"); 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'); print $query->endform(); $testText = $query->param('SPCtext') . $query->param('FieldOne') . $qu +ery->param('FieldTwo') . $query->param('FieldThree'); print $query->start_multipart_form("POST", "test"); print $query->textarea(-name=>'SPCtext', -cols=>50, -rows=>10, -value= +>$testText); print $query->submit('Save'); print $query->endform();
I tried having the textarea inside the first form but then the Field values don't exist until after the 'click'.
Am I missing something simple?
Thanks,
AM

In reply to 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.