hello, i have the following code: document.getElementById(''post_edit_form'').onsubmit = function () { alert(???); my question is how can i get the value of the submit button (i have to buttons)? Can anybody help me? greetings Gordon --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
On the server side, you''d do it by assigning a name/value pair. In Javascript the first thing I''d try is making sure the event object is passed to onsubmit (either with bindAsEventListener or Event.observe). Then test the properties of the event object to see if there is something useful there. Perhaps Event.element() might hold a useful value. e.g. myForm.onsubmit = function (evt) { // ... // alert(Event.element(evt)); // for (prop in evt) {console.log(prop +'': '' +evt[prop];} // ... }.bindAsEventListener(myForm); If all else fails, you can tie an onclick event to one of the buttons to differentiate behaviors. TAG On May 31, 2007, at 6:42 AM, gimler wrote:> > hello, > > i have the following code: > document.getElementById(''post_edit_form'').onsubmit = function () { > alert(???); > > my question is how can i get the value of the submit button (i have to > buttons)? > > Can anybody help me? > > greetings > Gordon > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
ohh yes it works fine. alert(evt[''explicitOriginalTarget''].name); thank you On 31 Mai, 17:11, Tom Gregory <t...-PGZyUNKar/Q@public.gmane.org> wrote:> On the server side, you''d do it by assigning a name/valuepair. > > In Javascript the first thing I''d try is making sure the event object > is passed to onsubmit (either with bindAsEventListener or > Event.observe). Then test the properties of the event object to see > if there is something useful there. Perhaps Event.element() might > hold a usefulvalue. > > e.g. > myForm.onsubmit = function (evt) { > // ... > // alert(Event.element(evt)); > // for (prop in evt) {console.log(prop +'': '' +evt[prop];} > // ... > > }.bindAsEventListener(myForm); > > If all else fails, you can tie an onclick event to one of the buttons > to differentiate behaviors. > > TAG > > On May 31, 2007, at 6:42 AM, gimler wrote: > > > > > hello, > > > i have the following code: > > document.getElementById(''post_edit_form'').onsubmit = function () { > > alert(???); > > > my question is how can i get thevalueof thesubmitbutton (i have to > > buttons)? > > > Can anybody help me? > > > greetings > > Gordon--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
FYI, that property is listed as Mozilla-specific. http://developer.mozilla.org/en/docs/DOM:event.explicitOriginalTarget TAG On Jun 1, 2007, at 2:10 AM, gimler wrote:> > ohh yes it works fine. > > alert(evt[''explicitOriginalTarget''].name); > > thank you > > > On 31 Mai, 17:11, Tom Gregory <t...-PGZyUNKar/Q@public.gmane.org> wrote: >> On the server side, you''d do it by assigning a name/valuepair. >> >> In Javascript the first thing I''d try is making sure the event object >> is passed to onsubmit (either with bindAsEventListener or >> Event.observe). Then test the properties of the event object to see >> if there is something useful there. Perhaps Event.element() might >> hold a usefulvalue. >> >> e.g. >> myForm.onsubmit = function (evt) { >> // ... >> // alert(Event.element(evt)); >> // for (prop in evt) {console.log(prop +'': '' +evt[prop];} >> // ... >> >> }.bindAsEventListener(myForm); >> >> If all else fails, you can tie an onclick event to one of the buttons >> to differentiate behaviors. >> >> TAG >> >> On May 31, 2007, at 6:42 AM, gimler wrote: >> >> >> >>> hello, >> >>> i have the following code: >>> document.getElementById(''post_edit_form'').onsubmit = function () { >>> alert(???); >> >>> my question is how can i get thevalueof thesubmitbutton (i have to >>> buttons)? >> >>> Can anybody help me? >> >>> greetings >>> Gordon > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---