Well I've run your code from your scratchpad, and even though there is a little syntax error in the line containing the text "There are some limitations", as it doesn't end in quote + comma, it works as I expect it should do, even with a plain "reset" without command line parameters. It must be a misunderstanding on your behalf.

You see, what this is supposed to do in a HTML form, is not clear the form, but reset it to its initial state, i.e. to the values as incorporated in the HTML. If a input element initially was empty, it should return to empty, but if it contents was "foo bar baz", then when pressing the button it should again contain "foo bar baz", and not become empty. And that is what it does, too. And this initial state is: After you encrypted the message, you should get the encrypted message again, and similar for the decrypted message.

If you want to return to the empty state, you should simply go to the initial URL again. Or you could enforce it by using Javascript in the onclick event of a submit button:

this.form.key.value = ""; this.form.cryptotext.value = ""; return false;
or, embedded in a CGI.pm call, near to "reset,":
submit('clear', "Clear", q[onclick="this.form.key.value = ''; this.for +m.cryptotext.value = ''; return false;"]),
The last Javascript statement prevents the form submission. With Javascript disabled, the form elements won't be cleared but the form submit will happen, and the CGI should catch it and display blank form. I think you should be able to make it work using CGI::delete or CGI::delete_all, or redirect to the form's own bare URL again without parameters. I'm not too deeply experienced in CGI.pm and I'm not planning on starting now.

Well, good luck with your project.


In reply to Re: Re: Re: Re: Re: Help w/ reset by bart
in thread Help w/ reset by bobasinbob

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.