[Proto-Scripty] Re: Observe form submit which button clicked?

2010-12-24 Thread T.J. Crowder
 instead I am taken straight to Google.

Yes, but the purpose of the page is that you're taken straight to
Google with the search term matching the button you clicked. If you
click foo, the code applies foo to the hidden field and Google
sees it. The submit buttons don't have names at all and so are not
sent to Google.
--
T.J. Crowder
Independent Software Engineer
tj / crowder software / com
www / crowder software / com

On Dec 24, 3:51 am, kstubs kst...@gmail.com wrote:
 T.J., Duhh!  Thanks for pointing out the obvious.  I was stuck on observing
 submit.  Now, I've tested your page in Chrome and FF, but doesn't seem to
 be working, instead I am taken straight to Google.

-- 
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.



[Proto-Scripty] Re: Observe form submit which button clicked?

2010-12-23 Thread T.J. Crowder
It can be even simpler than Walter's version, and I'm not aware of any
issues with `click` not bubbling:

  $('theForm').observe('click', function(event) {
// Find out if it was a submit button that was clicked
var button = event.findElement('input[type=submit]');
if (button) {
  // Yes, grab its value and do something with it.
  // In this example, we'll populate a hidden field
  // with the name q:
  this.down('input[name=q]').value = button.value;
}
  });

Here's a live example: http://jsbin.com/ukifo3

Works with IE6, IE7, Firefox, Opera, Chrome...

FWIW,
--
T.J. Crowder
Independent Software Engineer
tj / crowder software / com
www / crowder software / com

On Dec 22, 9:51 pm, kstubs kst...@gmail.com wrote:
 OK, just observing click event for the submit button is working fine.

-- 
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.



[Proto-Scripty] Re: Observe form submit which button clicked?

2010-12-23 Thread kstubs
T.J., Duhh!  Thanks for pointing out the obvious.  I was stuck on observing 
submit.  Now, I've tested your page in Chrome and FF, but doesn't seem to 
be working, instead I am taken straight to Google.

-- 
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.