By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,960 Members | 1,142 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,960 IT Pros & Developers. It's quick & easy.

Value returned from Perl or Javascript?

P: n/a

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.

Jan 20 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
am****@iwc.net wrote:
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.

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Jan 20 '06 #2

P: n/a

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.......

Jan 20 '06 #3

P: n/a
am****@iwc.net wrote:
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.

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Jan 20 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.