Re: Re: Help with extending HTML_QuickForm_select

From: Date: Tue, 08 Feb 2005 22:43:54 +0000
Subject: Re: Re: Help with extending HTML_QuickForm_select
References: 1 2 3  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-36077@lists.php.net to get a copy of this message
On Tuesday 08 February 2005 02:24 pm, Jamie Alessio wrote: > >>>>>>Ian Eure wrote: > > Does that make sense? > > Yes, that makes perfect sense now. I was missing the fact that you can > place a <script> tag in the middle of an HTML document and actually have > it execute functions. > Yeah, you just have to make sure that it comes after any elements you want to work with, since it gets executed before the entire document is parsed. Oh, and make sure you use the DOM functions to create the new elements. document.write() is deprecated and breaks XHTML. > > This is my point - there's no practical way to have a hierselect > > gracefully degrade to something that can work with a non-JS browser, > > which explains why there's nothing to do that. This is not the case with > > your multiselect code, which is simply a script-enhanced normal > > multiselect control, which is why you should think about making it > > degrade gracefully. > > Well said. I missed the point you were trying to make the first time. > Again, this is beside the point but you *could* degrade a hierselect > from something like (from the hierselect example): > > // first select > $select1[0] = 'Pop'; > $select1[1] = 'Classical'; > $select1[2] = 'Funeral doom'; > > // second select > $select2[0][0] = 'Red Hot Chili Peppers'; > $select2[0][1] = 'The Pixies'; > $select2[1][0] = 'Wagner'; > $select2[1][1] = 'Strauss'; > $select2[2][0] = 'Pantheist'; > $select2[2][1] = 'Skepticism'; > > to something like: > > $select[] = 'Pop: Red Hot Chili Peppers'; > $select[] = 'Pop: The Pixies'; > $select[] = 'Classical: Wagner'; > $select[] = 'Classical: Strauss'; > $select[] = 'Funeral Doom: Pantheist'; > $select[] = 'Funeral Doom: Skepticism'; > > where the user is presented with all the possible options at once that > the hierselect would normally present in several <select> elements. Of > course this could make for some gigantic lists, especially when you get > past two levels of depth for a hierselect. But, I think it is possible > to degrade the hierselect element to something usable for a > non-javascript browser. > Right - but that's not graceful degradation, that's a different approach to the problem. While you could script it so that cascading selects are created by breaking the sections out, this limits the text you can have in the selects, which is not desirable. You may also want to pass the intermediate values to the processing script, which your approach wouldn't do. > Ian - I'll take a look at your HTML_QuickForm_script class and then > tackle getting my stuff working for non-javascript browsers after I > steal some of your ideas.. ;) > Sounds great. :^)

Attachment: [application/pgp-signature]
« previous php.pear.dev (#36077) next »