Prev: FAQ Topic - How do I check to see if a child window is open, before opening another? (2010-04-20)
Next: FAQ Topic - How do I format a Number as a String with exactly 2 decimal places? (2010-03-30)
From: Thomas 'PointedEars' Lahn on 20 Apr 2010 21:53 Eric Bednarz wrote: > Garrett Smith <dhtmlkitchen(a)gmail.com> writes: >> […] an unnecessary a11y barrier. > > Words fail me. A(ccessibilit)y. Incidentally, a11y is an a11y barrier ;-) >>> <form action="..." method="post"> >>> <textarea name="myText" cols="30" rows="3"></textarea> >>> <input type="submit" name="button" value="Value1" /> >>> <input type="submit" name="button" value="Value2" /> >>> </form> > > I appreciate the absence of scripting to submit a form, but I think it > is still customary to use different names for multiple submit buttons if > you want to know which one was a successful control server-side. You can use different names, different values, or both. Using different names are better for i18n (internationalization) than using different values for the distinction (as you don't need to modify the server-side script then even though the button caption changes according to the user language). However, the point here was to use code that was as similar to the original one as possible. PointedEars -- Danny Goodman's books are out of date and teach practices that are positively harmful for cross-browser scripting. -- Richard Cornford, cljs, <cife6q$253$1$8300dec7(a)news.demon.co.uk> (2004)
From: Thomas 'PointedEars' Lahn on 20 Apr 2010 21:56 Garrett Smith wrote: > Eric Bednarz wrote: >> Garrett Smith <dhtmlkitchen(a)gmail.com> writes: >>>> Are you sure you want to use XHTML? >>> Probably not; that small sample contains XHTML errors. >> >> Please don't feel shy about being specific. > > Don't be scared to run the code through the w3c html validator and find > them for yourself. You don't know what you are talking about. It's a fragment of Valid XHTML 1.0 Transitional. PointedEars -- var bugRiddenCrashPronePieceOfJunk = ( navigator.userAgent.indexOf('MSIE 5') != -1 && navigator.userAgent.indexOf('Mac') != -1 ) // Plone, register_function.js:16
From: Thomas 'PointedEars' Lahn on 20 Apr 2010 22:02 Garrett Smith wrote: > Thomas 'PointedEars' Lahn wrote: >> Neil wrote: >>> <form onsubmit="return false;" action="[action]" method="post"> >>> <textarea name="myText" cols="30" rows="3"></textarea> >>> <input type="button" name="button" value="Value2" >>> onClick="this.form.submit();"/> >>> <input type="button" name="button" value="Value2" >>> onClick="this.form.submit();"/> >>> </form> > > Using javascript to submit the form creates an unnecessary a11y barrier. More, it is completely pointless and counter-productive in this case. > If you stop doing that; you should get the button value included in the > submission. > > The reason for this can be explained. Humor me. > When a form is submitted, the browser must determine which button was > activated (clicked) for the request. Yes, as can be read under "successful controls" in the HTML 4.01 Specification. > Your form prevents normal submission with : > | <form onsubmit="return false;" > > . > > The INPUT button being clicked is a separate event. The INPUT button's `click' event is irrelevant here. The problem is that calling the form's submit method does not make any button a successful control. >>> When I look at the posted values, I do not have a value for the >>> button. >>> How can I tell which of these buttons the user pressed? >> >> By RTFM and not shooting yourself in the foot: > > Link? Sense? PointedEars -- realism: HTML 4.01 Strict evangelism: XHTML 1.0 Strict madness: XHTML 1.1 as application/xhtml+xml -- Bjoern Hoehrmann
From: Neil on 20 Apr 2010 23:07 > By RTFM and not shooting yourself in the foot: > <form action="..." method="post"> > <textarea name="myText" cols="30" rows="3"></textarea> > <input type="submit" name="button" value="Value1" /> > <input type="submit" name="button" value="Value2" /> > </form> The problem is that I have text inputs on the form as well and the customer does not want the return key to submit the form. If I use input type="submit", the form always gets posted with a return keypress. -- Neil Aggarwal, (281)846-8957 FREE trial: cPanel VPS with unmetered bandwidth http://UnmeteredVPS.net/cpanel
From: Garrett Smith on 20 Apr 2010 23:50
Thomas 'PointedEars' Lahn wrote: > Garrett Smith wrote: > >> Thomas 'PointedEars' Lahn wrote: >>> Neil wrote: [...] >>>> When I look at the posted values, I do not have a value for the >>>> button. >>>> How can I tell which of these buttons the user pressed? >>> By RTFM and not shooting yourself in the foot: >> Link? > > Sense? > The OP does not know how to do what he wants done and that responding with "RTFM" is going to come off as churlish and vague. Make sense? -- Garrett comp.lang.javascript FAQ: http://jibbering.com/faq/ |