List Info

Thread: Alert if box not checked




Alert if box not checked
country flaguser name
United States
2007-04-17 22:23:55
Friends.

I want to pop up an alert if a checkbox isn't checked.

Below is the code I have so far.

Notes:
1. The cgi page is actuatlly at 
h
ttp://www.biblescramble.com/Esther/scriptCheck.cgi
2. x.cgi doesn't exist. This doesn't get that far. I'm just
working on the 
alert.
3. "if(1==1)" obviously is what needs to be
changed.

###
#!/usr/bin/perl

use CGI qw/:standard/;
use CGI::Carp qw(carpout fatalsToBrowser);

$script=<<END;
      function valid8() {
	if (1==1)				{
		alert("Not checked.");
						}
      			}
END


print header('text/html'),

start_html(-title=>"Check if check checked",
-script=>$script),

start_form(-name, "formA", -method,
"post", -action, "x.cgi", 
-onSubmit=>"return valid8()"),"n",

h2("Check this"), p, checkbox(-name,
"checker", value, "checker"), br,

p,submit("Submit"),

end_form,

end_html;
###

Thanks in advance!

Jerry

____________________________________________________________
_____
Exercise your brain! Try Flexicon. 
http://games.msn.com/en/flexicon
/default.htm?icid=flexicon_hmemailtaglineapril07

_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Userslistserv.ActiveState.com
To unsubscribe: http:/
/listserv.ActiveState.com/mailman/mysubs

Re: Alert if box not checked
country flaguser name
United States
2007-04-18 02:26:23
Jerry Kassebaum wrote:
> Friends.
> 
> I want to pop up an alert if a checkbox isn't checked.
> 
> Below is the code I have so far.
> 
> Notes:
> 1. The cgi page is actuatlly at 
> h
ttp://www.biblescramble.com/Esther/scriptCheck.cgi
> 2. x.cgi doesn't exist. This doesn't get that far. I'm
just working on the 
> alert.
> 3. "if(1==1)" obviously is what needs to be
changed.
> 
> ###
> #!/usr/bin/perl
> 
> use CGI qw/:standard/;
> use CGI::Carp qw(carpout fatalsToBrowser);
> 
> $script=<<END;
>       function valid8() {
> 	if (1==1)				{
> 		alert("Not checked.");
> 						}
>       			}
> END
> 
> 
> print header('text/html'),
> 
> start_html(-title=>"Check if check
checked", -script=>$script),
> 
> start_form(-name, "formA", -method,
"post", -action, "x.cgi", 
> -onSubmit=>"return
valid8()"),"n",
> 
> h2("Check this"), p, checkbox(-name,
"checker", value, "checker"), br,
> 
> p,submit("Submit"),
> 
> end_form,
> 
> end_html;
> ###

#!perl --

use strict;
use warnings;
use CGI qw/:standard/;
use CGI::Carp qw(carpout fatalsToBrowser);

my $script = <<'END';
function valid8 () {
var f = document.forms["formA"];
var els = f.elements;
var ck = els["checker"].checked;
if (! ck) {
	alert ("Not checked");
// I'm not sure how you keep the submit from going at this
point
}
}
END

print header('text/html'),
   start_html(-title => 'Check if check checked', -script
=> $script), "n",
   start_form(-name => 'formA', -method => 'post',
-action => 'penv.pl',
     -onSubmit => 'return valid8 ()'), "n",
     h2('Check this'), "n", p, checkbox(-name
=> 'checker', value => 'checked'),
     p, "n", br, submit('Submit'),
"n",
   end_form, "n",
   end_html, "n";

__END__
_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Userslistserv.ActiveState.com
To unsubscribe: http:/
/listserv.ActiveState.com/mailman/mysubs

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )