On Friday, September 11, 2015 at 8:58:56 AM UTC-4, Dan Campbell wrote:
> Hi,
>
> I've been having some difficulty, locating documentation that explains how to
> get a listbox item value. There are loads of examples of how to obtain or
> set the value of a text area, or of a browse-style list.
>
> I think the problem is that, in the html, it's not actually called 'listbox',
> and therefore a Google search isn't producing optimal results.
>
> So if we have a listbox lst_01 as below, how would we obtain the second item
> ("Value_02")?
>
> <select name="lst_01" multiple size="4" id="lst_01"
> style="position:absolute;left:435px;top:293px;width:162px;height:74px;z-index:25;"
> title="lst_01">
> <option selected value="Value_01">Item_01</option>
> <option value="Value_02">Item_02</option>
> <option value="Value_03">Item_03</option>
> </select>
>
>
> If we try to get the listbox object, by setting lst_01 to
>
> ( ef/from "#lst_01" ( ef/read-form-input ) )
>
>
> , then the contents of lst_01 in Clojurescript, is just a unit set of the
> first (selected) value
>
> #{"Value_01"}
>
>
> Is there a way to obtain non-Selected values, anywhere in the listbox? Or a
> vector/list of all values?
>
> It's clear how to do this in Javascript, but I'd like to stick with
> Clojurescript idioms, preferably with Enfocus. But even a non-Enfocus
> example, would help.
In case anyone is having similar issues, here is Creighton Kirkendall's
solution (he maintains Enfocus):
You should be able to get it from the options like this.
(from "#lst_01 > option" (get-prop :value))
, and it does indeed return the list of values, in that listbox.
--
Note that posts from new members are moderated - please be patient with your
first post.
---
You received this message because you are subscribed to the Google Groups
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/clojurescript.