> If only I could find a javascript ref as good as Raul's html ref: > http://blooberry.com/indexdot/html/index2.htm !
No sooner said, than Google's AdWords offered me this link: Developer's cheat-sheet http://www.visibone.com/products/browserbook.html I'm going to treat myself to it for Christmas and report back with a review. On Wed, Dec 14, 2011 at 4:57 PM, Ian Clark <earthspo...@gmail.com> wrote: >> I think adding support for multiple select is pretty simple. As a quick >> experiment you could create a variant of jhselect that added the word >> multiple in the html. > > You're right, it is simple, just a case of putting the attribute: > 'multiple' into the <select tag. See my first post, where I create a > variant of jhselect called jhselectmultiple. This works fine. > > It's the second part of the task that's foxed me, exploring javascript > to detect and find the multiple selections that have been made. > > If only I could find a javascript ref as good as Raul's html ref: > http://blooberry.com/indexdot/html/index2.htm ! > > It intrigues me that whoever in Sun designed the selectedIndex feature > in javascript (or DOM) didn't think to generalize it to accommodate > the Multiple attribute in <select. Or didn't bother... (but that's me, > grousing again!) > > I see the Wikipedia article on javascript contains the quote: > "Anyway I know only one programming language worse than C and that is > Javascript. [...] " > ...a rank slander on C, which I'm very fond of. > > > On Wed, Dec 14, 2011 at 4:34 PM, Eric Iverson <eric.b.iver...@gmail.com> > wrote: >> I think adding support for multiple select is pretty simple. As a quick >> experiment you could create a variant of jhselect that added the word >> multiple in the html. Not sure of the details,but something like: >> >> <select multiple ....> instead of the <select ...> >> >> If this works in the sense that it gives you the gui you want, then you >> then need to figure out how the events are triggered for multiple selection >> but I don't think that would be too hard. >> >> On Wed, Dec 14, 2011 at 11:29 AM, Ian Clark <earthspo...@gmail.com> wrote: >> >>> Thanks, Eric. >>> >>> I guess I was trawling for a simple-stupid answer, to save doing it >>> the hard way. >>> >>> I'd thought of a table of checkboxes, but since the list to be checked >>> is scrollable (and individual items can be hidden) it's not so >>> straightforward. >>> >>> Fortunately, in this particular instance, it's easy to arrange for the >>> engine which governs the list to accumulate selections, and flag them >>> with stars, so that's the way I'll go. It demands nothing clever from >>> the gui, which IME is always a good idea for a portable app. >>> >>> On Wed, Dec 14, 2011 at 2:59 PM, Eric Iverson <eric.b.iver...@gmail.com> >>> wrote: >>> > There is a "select multiple" html tag. You'll have to dig into the html >>> and >>> > javascript docs on this and provide new jhs wrappers to make it easy to >>> use >>> > from J. I think the code will be trivial but the homework to figure out >>> the >>> > code will be more difficult. Depending on the app requirements a table of >>> > checkboxes is another way to go (see jal for an example of this). >>> > >>> > On Wed, Dec 14, 2011 at 3:24 AM, Ian Clark <earthspo...@gmail.com> >>> wrote: >>> > >>> >> Trying to port a j6 jwd app to j7 jhs. It has a listbox accepting >>> >> multiple selections, defined like this: >>> >> >>> >> xywh 5 16 244 100;cc panel listbox ws_vscroll lbs_multiplesel >>> >> rightmove bottommove; >>> >> >>> >> The JHS framework offers a verb: jhselect to generate a Select object, >>> >> which IMO is the thing to use in its place. But it only allows single >>> >> lines to be selected. >>> >> >>> >> How do I get multiple selections, *plus* reading back what lines are >>> >> selected? >>> >> >>> >> If I define a variant (the only difference from jhselect being that >>> >> I've inserted 'multiple' in line 1) ... >>> >> >>> >> jhselectmultiple=: 4 : 0 >>> >> 'values size sel'=. y >>> >> t=. '<select id="<ID>" name="<ID>" class="jhselect" size="<SIZE>" >>> >> multiple onchange="return jev(event)" >' >>> >> t=. t hrplc 'ID SIZE SEL';x;size;sel >>> >> opt=. '<option value="<VALUE>" label="<VALUE>" >>> <SELECTED>><VALUE></option>' >>> >> for_i. i.#values do. >>> >> t=. t,opt hrplc'VALUE >>> >> SELECTED';(i{values),(i=sel){'';'selected="selected"' >>> >> end. >>> >> t=. t,'</select>' >>> >> ) >>> >> >>> >> and call it in HBS with a line like this: >>> >> >>> >> 'sel' jhselectmultiple sel_text ; sel_size ; sel_index >>> >> >>> >> then this does indeed generate a Select object with id="sel" which >>> >> accepts multiple selections. >>> >> >>> >> However, I can only see the first selection, using this javascript >>> >> function (borrowed from jdemo4): >>> >> >>> >> function ev_sel_change() >>> >> { >>> >> jbyid("which").innerHTML= JEV+" : "+jbyid("selm").selectedIndex; >>> >> } >>> >> >>> >> I don't know the DOM well enough to know what I should be using instead. >>> >> >>> >> I've tried googling for selectedIndex and get this link: >>> >> http://www.javascriptkit.com/jsref/select.shtml >>> >> but it merely confirms that the above is the behavior of selectIndex >>> >> when 'multiple' is specified, without suggesting what to use instead. >>> >> >>> >> (Does anyone know a better DOM reference link?) >>> >> ---------------------------------------------------------------------- >>> >> For information about J forums see http://www.jsoftware.com/forums.htm >>> >> >>> > ---------------------------------------------------------------------- >>> > For information about J forums see http://www.jsoftware.com/forums.htm >>> ---------------------------------------------------------------------- >>> For information about J forums see http://www.jsoftware.com/forums.htm >>> >> ---------------------------------------------------------------------- >> For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm