Author | Topic: HTML invention I don't understand | |
---|---|---|
Bruce Anderson | HTML invention I don't understand on Wed, 30 Aug 2006 16:06:10 -0500 Many of my websites have a need for a special kind of input type. This arises when the user can pick no more than one of a list of things, but picking none is also acceptable. The type=radio button and type=select options both have a severe drawback; that being, when one item is selected, the user cannot get back to "no items selected" state. It is impossible to "unpush" a choice. The frustrated user has to reset the entire screen to get out of this box. It is truly a moment of carelessness, a lifetime of regret scenario. I noodled around and now have a radio button which can be singularly cleared with a double click. This is obviously an important discovery, alert the Nobel Committee!, but, for the life of me, I don't know why this particular code works, and I will be most embarrassed when they present me with the award. In particular, why is it a double click that does the deed, rather than a single click? If you can explain it, I will split the medal with you. If you can improve on it, you get the neck ribbon, as well. Bruce Anderson (The test site to which the form is submitted returns the values of all vars in the form. Don't be fooled. HOLD_RADIO is not the name of radio button. It is a var used to make a status comparison. "radio_button" is the name of the selectable variable.) test.htm | |
James Loughner | Re: HTML invention I don't understand on Wed, 30 Aug 2006 21:31:24 -0400 Hi Bruce Did not work for me using ThunderBird on SuSE Linux. Might only work on MS stuff probably because its broken. Jim Bruce Anderson wrote: > Many of my websites have a need for a special kind of input type. This > arises when the user can pick no more than one of a list of things, but > picking none is also acceptable. The type=radio button and type=select > options both have a severe drawback; that being, when one item is selected, > the user cannot get back to "no items selected" state. It is impossible to > "unpush" a choice. The frustrated user has to reset the entire screen to > get out of this box. It is truly a moment of carelessness, a lifetime of > regret scenario. > > I noodled around and now have a radio button which can be singularly cleared > with a double click. This is obviously an important discovery, alert the > Nobel Committee!, but, for the life of me, I don't know why this particular > code works, and I will be most embarrassed when they present me with the > award. In particular, why is it a double click that does the deed, rather > than a single click? If you can explain it, I will split the medal with > you. If you can improve on it, you get the neck ribbon, as well. > > Bruce Anderson > > (The test site to which the form is submitted returns the values of all vars > in the form. Don't be fooled. HOLD_RADIO is not the name of radio button. > It is a var used to make a status comparison. "radio_button" is the name of > the selectable variable.) > > > > Radio button invention...double click on a selected button to clear it. > Choices A - D exhibit normal radio button behavior, plus you can clear a > selection without choosing another value by double clicking on the button. > Choice E is a standard radio button, which does not have the total clear > method. > > A > B > C > D > E > | |
Sander Elias | Re: HTML invention I don't understand on Thu, 31 Aug 2006 09:16:18 +0200 Bruce, >I noodled around and now have a radio button which can be singularly cleared >with a double click. This is obviously an important discovery, alert the >Nobel Committee!, but, for the life of me, I don't know why this particular >code works, and I will be most embarrassed when they present me with the >award. In particular, why is it a double click that does the deed, rather >than a single click? If you can explain it, I will split the medal with >you. If you can improve on it, you get the neck ribbon, as well. I looked at it, and I understand how it works. This works only in IE on windows! not in any other browser, so it is not a very good solution. I will look into it later on more deeply, and will come up with a other solution. But give me a few day's! Regards Sander Elias ------------------------------------------------------------- xbHCL (http://www.xbHCL.com) the xbase HTML command layer PBIH (http://pbih.eu) Polar Bear International Hosting ------------------------------------------------------------- also a member off the XXP (http://www.xxp.nl) | |
Sander Elias | Re: HTML invention I don't understand on Thu, 31 Aug 2006 15:19:02 +0200 Bruce, I had the need for a small distraction, so I looked at your problem. see the attached HTML file. you can check and uncheck any button with a single click, works in both IE and Firefox (did not test other browsers, but it should work there too.) it's a simple case of checking the state when the mouse button comes 'up', and reset the button if it has set before. you have to use the mouseup in stead off the onclick because the button is setted before the evaluation of onclick! hope you can use this. Regards Sander Elias ------------------------------------------------------------- xbHCL (http://www.xbHCL.com) the xbase HTML command layer PBIH (http://pbih.eu) Polar Bear International Hosting ------------------------------------------------------------- also a member off the XXP (http://www.xxp.nl) | |
Sander Elias | Re: HTML invention I don't understand - radiodemo.html on Thu, 31 Aug 2006 15:20:02 +0200 oops, forgot the attachment! Regards Sander Elias ------------------------------------------------------------- xbHCL (http://www.xbHCL.com) the xbase HTML command layer PBIH (http://pbih.eu) Polar Bear International Hosting ------------------------------------------------------------- also a member off the XXP (http://www.xxp.nl) radiodemo.html | |
James Loughner | Re: HTML invention I don't understand - radiodemo.html on Thu, 31 Aug 2006 12:49:48 -0400 Still does not work in Linux with FireFox Jim Sander Elias wrote: > oops, forgot the attachment! > Regards > Sander Elias > > ------------------------------------------------------------- > xbHCL (http://www.xbHCL.com) the xbase HTML command layer > PBIH (http://pbih.eu) Polar Bear International Hosting > ------------------------------------------------------------- > also a member off the XXP (http://www.xxp.nl) > > > ------------------------------------------------------------------------ > > choiche A > choiche B > choiche C > choiche D > choiche E > | |
James Loughner | Re: HTML invention I don't understand - radiodemo.html on Thu, 31 Aug 2006 12:54:49 -0400 Sorry was still trying in Thunderbird It works fine in FireFox and Konqueror Jim Sander Elias wrote: > oops, forgot the attachment! > Regards > Sander Elias > > ------------------------------------------------------------- > xbHCL (http://www.xbHCL.com) the xbase HTML command layer > PBIH (http://pbih.eu) Polar Bear International Hosting > ------------------------------------------------------------- > also a member off the XXP (http://www.xxp.nl) > > > ------------------------------------------------------------------------ > > choiche A > choiche B > choiche C > choiche D > choiche E > | |
Sander Elias | Re: HTML invention I don't understand - radiodemo.html on Thu, 31 Aug 2006 19:04:10 +0200 Jim, >Sorry was still trying in Thunderbird It works fine in FireFox and >Konqueror Thanks for the confirmation! Regards Sander Elias ------------------------------------------------------------- xbHCL (http://www.xbHCL.com) the xbase HTML command layer PBIH (http://pbih.eu) Polar Bear International Hosting ------------------------------------------------------------- also a member off the XXP (http://www.xxp.nl) | |
Osvaldo Ramirez | Re: HTML invention I don't understand on Thu, 31 Aug 2006 09:04:43 -0600 Dear Sander Elias Only a comment I am using Thunterbird as news reader, and it show the attachment as part of the message, but If I click on the button A and click again on the button A, it doesnt check and unchech the button Best Regards Osvaldo Ramirez > Bruce, > > I had the need for a small distraction, so I looked at your problem. > > see the attached HTML file. you can check and uncheck any button with > a single click, works in both IE and Firefox (did not test other > browsers, but it should work there too.) > it's a simple case of checking the state when the mouse button comes > 'up', and reset the button if it has set before. > you have to use the mouseup in stead off the onclick because the > button is setted before the evaluation of onclick! > > hope you can use this. > Regards > Sander Elias > > ------------------------------------------------------------- > xbHCL (http://www.xbHCL.com) the xbase HTML command layer > PBIH (http://pbih.eu) Polar Bear International Hosting > ------------------------------------------------------------- > also a member off the XXP (http://www.xxp.nl) De | |
Sander Elias | Re: HTML invention I don't understand on Thu, 31 Aug 2006 17:12:57 +0200 Osvaldo, >I am using Thunterbird as news reader, and it show the attachment as >part of the message, but If I click on the button A and click again on >the button A, it doesnt check and unchech the button Well, that makes sense! as it is a news/mail reader, it should not execute ANY java script. although there is very little JS in the sample, it will only run in a 'browser' that has JS enabled! Regards Sander Elias ------------------------------------------------------------- xbHCL (http://www.xbHCL.com) the xbase HTML command layer PBIH (http://pbih.eu) Polar Bear International Hosting ------------------------------------------------------------- also a member off the XXP (http://www.xxp.nl) | |
Bruce Anderson | Re: HTML invention I don't understand on Thu, 31 Aug 2006 14:54:28 -0500 I will inform Stockholm to send the prize to you. Thank you, sir, for the insight. | |
Sander Elias | Re: HTML invention I don't understand on Fri, 01 Sep 2006 06:54:32 +0200 Bruce, >I will inform Stockholm to send the prize to you. Thank you, sir, for the >insight. Well, Thanks But on a more serious side, this kind off programming is a direct violation off the w3.org standard. I understand why you would want to use anything like this, but you should consider using checkboxes in stead of radio button's with a little scripting you can let them behave exactly the same as radio button, and it would be 'legal' to uncheck all off them. quote from w3.org html 4.01 specs: --------------------------------------------------------------------------------------------------------------- radio buttons Radio buttons are like checkboxes except that when several share the same control name, they are mutually exclusive: when one is switched "on", all others with the same name are switched "off". The INPUT element is used to create a radio button control. If no radio button in a set sharing the same control name is initially "on", user agent behavior for choosing which control is initially "on" is undefined. Note. Since existing implementations handle this case differently, the current specification differs from RFC 1866 ([RFC1866] section 8.1.2.4), which states: At all times, exactly one of the radio buttons in a set is checked. If none of the <INPUT> elements of a set of radio buttons specifies `CHECKED', then the user agent must check the first radio button of the set initially. Since user agent behavior differs, authors should ensure that in each set of radio buttons that one is initially "on". -----<quote end >------------------------------------------------------------------------------------------------------ If you want a sample off a radio-check-boxes just drop me a note, and I will see what I can do! Regards Sander Elias ------------------------------------------------------------- xbHCL (http://www.xbHCL.com) the xbase HTML command layer PBIH (http://pbih.eu) Polar Bear International Hosting ------------------------------------------------------------- also a member off the XXP (http://www.xxp.nl) | |
Bruce Anderson | Re: HTML invention I don't understand on Fri, 01 Sep 2006 08:28:59 -0500 I have been doing that checkbox trick for the last 3 years. And I know about the w3.org standard on radio buttons; in fact, I believe being able to set the "checked" value is said to be impossible in that same standard. Luckily for me, it ignores its own standard. The problem I have with the checkbox solution is that it is based in a javascript which grows geometrically with the number of checkboxes, and the script does not lend itself to being generated algorithmically. The clearance routine requires each checkbox in the group to have a list of all the affected vars, which is an approach that shouts "typo error". Furthermore, it means that there are multiple variables to be checked to answer the single question "What do you want for lunch?" because each checkbox has its own variable name. Consequently, data analysis coding becomes more complex. The radio button solution means that I can generate pages from a database because each button contains its own clearing code, and that code is identical across all of the buttons. There is only one variable to examine on the analysis side, so that coding is simplier, too. My goal is to build websites that create their pages dynamically. This approach means my customer can enter all of their mutually exclusive choices into a dbf and my page builder algorithm will just do it, regardless of how many there are, and then my program does the all typing, rather than me. The original push button radios, on which this control is modelled, were in the cars I drove through the early '70s. On those radios, you could unpush a button. I think this modified input has precedence on its side, and it fills a need that exists in real programming world. Viva la click, click! | |
James Loughner | Re: HTML invention I don't understand on Fri, 01 Sep 2006 11:25:00 -0400 Seems to me the easiest way is to simply add a button called NONE. This would also give the user a clue that it is an option. Jim Bruce Anderson wrote: > I have been doing that checkbox trick for the last 3 years. And I know about > the w3.org standard on radio buttons; in fact, I believe being able to set > the "checked" value is said to be impossible in that same standard. Luckily > for me, it ignores its own standard. > > The problem I have with the checkbox solution is that it is based in a > javascript which grows geometrically with the number of checkboxes, and the > script does not lend itself to being generated algorithmically. The > clearance routine requires each checkbox in the group to have a list of all > the affected vars, which is an approach that shouts "typo error". > Furthermore, it means that there are multiple variables to be checked to > answer the single question "What do you want for lunch?" because each > checkbox has its own variable name. Consequently, data analysis coding > becomes more complex. > > The radio button solution means that I can generate pages from a database > because each button contains its own clearing code, and that code is > identical across all of the buttons. There is only one variable to examine > on the analysis side, so that coding is simplier, too. My goal is to build > websites that create their pages dynamically. This approach means my > customer can enter all of their mutually exclusive choices into a dbf and my > page builder algorithm will just do it, regardless of how many there are, > and then my program does the all typing, rather than me. > > The original push button radios, on which this control is modelled, were in > the cars I drove through the early '70s. On those radios, you could unpush > a button. I think this modified input has precedence on its side, and it > fills a need that exists in real programming world. Viva la click, click! > > | |
Sander Elias | Re: HTML invention I don't understand on Fri, 01 Sep 2006 17:51:03 +0200 Bruce, >I have been doing that checkbox trick for the last 3 years. And I know about >the w3.org standard on radio buttons; in fact, I believe being able to set >the "checked" value is said to be impossible in that same standard. Luckily >for me, it ignores its own standard. Sorry, but your wrong on this one! it clearly states that the designer should check one by default, using the 'checked attribute on the input. I do this on a frequent base! >The problem I have with the checkbox solution is that it is based in a >javascript which grows geometrically with the number of checkboxes, and the >script does not lend itself to being generated algorithmically. The >clearance routine requires each checkbox in the group to have a list of all >the affected vars, which is an approach that shouts "typo error". >Furthermore, it means that there are multiple variables to be checked to >answer the single question "What do you want for lunch?" because each >checkbox has its own variable name. Consequently, data analysis coding >becomes more complex. Well, I think I can create a radio-button solution that is almost as simple as my radio-button one (although the function will be slightly larger!) I have to try it to be entirely sure, but I think if you name all your checkboxes equal (as with radio button) you can use the same algorithm for both the checkbox solution, and the radio-button. If I had more time available, I would try it out for you. >The radio button solution means that I can generate pages from a database >because each button contains its own clearing code, and that code is >identical across all of the buttons. There is only one variable to examine >on the analysis side, so that coding is simplier, too. My goal is to build >websites that create their pages dynamically. This approach means my >customer can enter all of their mutually exclusive choices into a dbf and my >page builder algorithm will just do it, regardless of how many there are, >and then my program does the all typing, rather than me. As I stated above,I believe this would be possible for checkboxes too! >The original push button radios, on which this control is modelled, were in >the cars I drove through the early '70s. On those radios, you could unpush >a button. I think this modified input has precedence on its side, and it >fills a need that exists in real programming world. Viva la click, click! Well, you have a partial point there, I remember those radio's. the design was not meant to un push buttons. If one did that, most off the time the would only produce a loud noise after that! (also the radio did not 'know' what to do in such a case...)\ the same goes for radio-buttons, you can fiddle around to un push all, but what's the state after that??? As always', there are arguments to neglect a standard. But I would rather follow them. In this age people are more and more accustomed to a certain way off doing things, and breaking with that convention might not be wise. Just my 2 cents Regards Sander Elias ------------------------------------------------------------- xbHCL (http://www.xbHCL.com) the xbase HTML command layer PBIH (http://pbih.eu) Polar Bear International Hosting ------------------------------------------------------------- also a member off the XXP (http://www.xxp.nl) | |
Bruce Anderson | Re: HTML invention I don't understand on Sat, 02 Sep 2006 12:06:22 -0500 >>...the same goes for radio-buttons, you can fiddle around to un push all, >>but what's the state after that??? oHtml:getVar() will return a NIL. Assuming that you configure a wrapper function around your oHtml:getVar() to set NILs = chr(0) (smart practice in a character type only environment), then one radio var handles a one-to-many list of exclusive choices, and the data driven page generation routine can step through the appropriate dbf spitting out lines of html code. > ...but I think if you name all your checkboxes equal (as with radio > button) you can use the same algorithm for both the checkbox solution, and > the radio-button. If you name all the checkboxes the same, then you have to give them return values that are not boolean, which is contrary to their design of returning a logical TRUE. You also have to identify which of the several identically identified checkboxes you have to set to "not checked" when you check this one, a tricky piece of code for me, because identifying them individually by name has been eliminated. The beauty of the radio button is that the browser treats it as an array. If you want to do that with checkboxes, you have to make your own array handler. A lot of my business is in creating and running questionnaires, and then analyzing the collected data. I want to know that a respondent actually looked at and answered a question, rather than be fooled into thinking he did because I have loaded in default values. My "prior to submission routine" flags those questions which have not been answered to the responder. Hopefully, I can get them to go back and correct their oversights. Those that do come through blank will generate a followup phone call from me, and when I start dialing the phone, I start burning money. I agree with you that we should make programs harmonize with how people do things, but my experience is that most people are not programmers; they do things quite differently from the ways you and I do. And the next time you use a shoe for an impromptu hammer, realize that you have just become one of them. Most respectfully, Bruce | |
Sander Elias | Re: HTML invention I don't understand on Sun, 03 Sep 2006 13:46:25 +0200 Bruce; >>>...the same goes for radio-buttons, you can fiddle around to un push all, >>>but what's the state after that??? >oHtml:getVar() will return a NIL. Assuming that you configure a wrapper >function around your oHtml:getVar() to set NILs = chr(0) (smart practice in >a character type only environment), then one radio var handles a one-to-many >list of exclusive choices, and the data driven page generation routine can >step through the appropriate dbf spitting out lines of html code. Hmm, apparently I wasn't too clear. I meant this as a rhetorical question but if 'none' is a valid choice, you should list it! I know what it returns program wise (actually, nothing is returned!, that is what causes html:getvar to give you back a nil, it could not find the variable in the response, so it gives back a nil! >> ...but I think if you name all your checkboxes equal (as with radio >> button) you can use the same algorithm for both the checkbox solution, and >> the radio-button. >If you name all the checkboxes the same, then you have to give them return >values that are not boolean, which is contrary to their design of returning >a logical TRUE. You also have to identify which of the several identically >identified checkboxes you have to set to "not checked" when you check this >one, a tricky piece of code for me, because identifying them individually by >name has been eliminated. The beauty of the radio button is that the >browser treats it as an array. If you want to do that with checkboxes, you >have to make your own array handler. Well, I think it is easily done using just a few lines off JS, you don't need a complete array handler, just traversing the DOM is enough. I will write a sample for you to demonstrate it, but not right now! leaving for a small trip within 48 hours. >A lot of my business is in creating and running questionnaires, and then >analyzing the collected data. I want to know that a respondent actually >looked at and answered a question, rather than be fooled into thinking he >did because I have loaded in default values. My "prior to submission >routine" flags those questions which have not been answered to the >responder. Hopefully, I can get them to go back and correct their >oversights. Those that do come through blank will generate a followup phone >call from me, and when I start dialing the phone, I start burning money. I >agree with you that we should make programs harmonize with how people do >things, but my experience is that most people are not programmers; they do >things quite differently from the ways you and I do. And the next time you >use a shoe for an impromptu hammer, realize that you have just become one of >them. well Ok, here you have a valid reason to not select a default choice! I still think you should go for checkboxes. I have stated my opinion on that already, so I'm not going to repeat them now. On the other side, you have a point on the shoe story Damn, I'm one off them.... regards Sander Regards Sander Elias ------------------------------------------------------------- xbHCL (http://www.xbHCL.com) the xbase HTML command layer PBIH (http://pbih.eu) Polar Bear International Hosting ------------------------------------------------------------- also a member off the XXP (http://www.xxp.nl) |