Value returned from Perl or Javascript?

A

amerar

Hi All,

I have a form which has some Javascript validation. On my form there
is a button, and, if that button is selected or clicked, then I want to
set a variable to one value and then pass that along to the Perl/CGI
program. If the button was not clicked, I want to set the variable to
a different value,,,,,,,,,,

If there a way for me to do this? I'm lost on how to return the value
back to the Perl scipt, if my thought process is even
correct.............

Thanks.
 
D

David Dorward

I have a form which has some Javascript validation. On my form there
is a button, and, if that button is selected or clicked, then I want to
set a variable to one value and then pass that along to the Perl/CGI
program. If the button was not clicked, I want to set the variable to
a different value,,,,,,,,,,

<input type="submit" name="mySubmit" value="Submit">

my $q = CGI->new();
my $submit = $q->param('mySubmit');
if (defined $submit) {
print $submit;
}

No need for JavaScript.
 
A

amerar

David,

Not sure that is what I want. I already have the form with several
buttons and text boxes on it. This particular button has an 'onclick'
event which validates some of the fields. Once that is done, it will
go to the server and run the Perl program.

If this button was clicked, I want to set some sort of variable so I
know in my Perl program that this button was clicked.......
 
D

David Dorward

Not sure that is what I want.

Not sure what is what you want?

http://www.safalra.com/special/googlegroupsreply/
http://oakroadsystems.com/genl/unice.htm#quote
I already have the form with several buttons and text boxes on it. This
particular button has an 'onclick' event which validates some of the
fields. Once that is done, it will go to the server and run the Perl
program.

So make sure you are doing that by having it as a submit button, and then
returning true or false from the event handler (and not calling the
submit() method of teh form object).
If this button was clicked, I want to set some sort of variable so I
know in my Perl program that this button was clicked.......

And by giving it a unique combination of name and value, as I suggested
previously, that is exactly what you'll be doing.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top