Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Re: Why is my CGI.pm script trying to assign data before pressing submit.

by CharlesClarkson (Curate)
on Dec 07, 2001 at 20:30 UTC ( #130225=note: print w/ replies, xml ) Need Help??


in reply to Re: Why is my CGI.pm script trying to assign data before pressing submit.
in thread Why is my CGI.pm script trying to assign data before pressing submit.

With CGI.pm you would need these:

use CGI; my $p = new CGI; my $js_func = qq| function checkform (form) { if (form.report.value == '') { alert('You need to enter a filename!'); form.report.focus; return false; } return true; } |;

Place the script in $p->start_html using -script.

print $p->start_html( -script => $js_func );

Then, when you start the form, use:

print $p->start_form(-onsubmit => 'checkform(this)');


HTH,
Charles


Comment on Re: Re: Why is my CGI.pm script trying to assign data before pressing submit.
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://130225]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (13)
As of 2014-09-19 19:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (144 votes), past polls