How do you retrieve the value of an item in a listbox, in Enfocus?

15 views
Skip to first unread message

Dan Campbell

unread,
Sep 11, 2015, 5:02:14 PM9/11/15
to Enfocus


Hi,

I posted this on the Clojurescript group (apologies for the repetition), but maybe the Enfocus group is more appropriate.


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.


ckirkendall

unread,
Sep 11, 2015, 5:16:42 PM9/11/15
to Enfocus
You should be able to get it from the options like this.

(from "#lst_01 > option" (get-prop :value))

Dan Campbell

unread,
Sep 11, 2015, 5:27:23 PM9/11/15
to Enfocus

Holy four letter word.  That returns the entire set of values.  Thanks, Creighton.

I'll go ahead and copy your response, on the Clojurescript group, in case anyone else has the same confusions.
Reply all
Reply to author
Forward
0 new messages