LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 06-27-2005, 11:03 AM   #1
djgerbavore
Member
 
Registered: Jun 2004
Location: PA
Distribution: Fedora (latest git kernel)
Posts: 443

Rep: Reputation: 30
found with button was clicked


hey,
i want to be able to know which button was clicked before i send the form, for example
Code:
<script>
function confirm() {
   /* need to know which button was click, before i send the form */
}
</script>
<form name='myform.php' onsubmit=return 'confirm()'>

<input type='submit' value='one'>
<input type='submit' value='two'>
<input type='submit' value='three'>

</form>

thanks,

djgerbavor3
 
Old 06-29-2005, 03:25 AM   #2
keefaz
Senior Member
 
Registered: Mar 2004
Distribution: Slackware
Posts: 4,607

Rep: Reputation: 135Reputation: 135
Not tested, but you could try add a global variable like :
Code:
<script>
currentButton = '';

function update_current(but) {
    currentButton = but;
}
function confirm() {
    alert('Button clicked: '+currentButton);
   /* need to know which button was click, before i send the form */
}
</script>
<form name='myform.php' onsubmit=return 'confirm()'>

<input type="submit" value="one" onclick="update_current('one');">
<input type="submit" value="two" onclick="update_current('two');">
<input type="submit" value="three" onclick="update_current('three');">

</form>
 
Old 06-29-2005, 09:35 AM   #3
djgerbavore
Member
 
Registered: Jun 2004
Location: PA
Distribution: Fedora (latest git kernel)
Posts: 443

Original Poster
Rep: Reputation: 30
Thanks for your reply, i did something similar to what you did and it work, thanks for you help


djgerbavor3
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Unable to execute code in Implementation class when a button is clicked Gnarg Programming 2 12-01-2005 06:36 AM
xbindkeys: How to get name of clicked program lagu2653 Linux - Software 1 06-27-2005 05:28 AM
Mom clicked a button and "it stopped working" antiocles Linux - Software 3 01-02-2005 01:35 PM
ColdFusion - Using a script to build and execute SQL query when a button is clicked Locura Programming 1 02-25-2004 09:59 PM
Abiword crashes when print button clicked cougyr Linux - Software 2 11-29-2003 12:15 PM


All times are GMT -5. The time now is 02:59 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration