On Tuesday 04 March 2008 02:43:26 gtarcea wrote:
> Hi,
>
> I'm trying to get the selected text when I double click in a selector.
> For example I have code like the following:
>
> controller.py:
>
> molecules = [(0, "csf1r"), (1, "pwp1"), (2, "sox")]
> molecule_selector = MultipleSelectField("myselector", options =
> molecules)
>
>
> class HomeController(controllers.Controller):
>     @expose("mimiweb30.templates.home.index")
>     def index(self):
>         return dict(active_section='home',
> molecule_selector=molecule_selector)
>
> This creates a selector like the following:
>
> <select size="5" multiple class="multipleselectfield"
> name="myselector" id="myselector">
> <option value="0">csf1r</option>
> <option value="1">pwp1</option>
> <option value="2">sox</option>
> </select>
>
> I then have a little bit of Javascript like the following:
>
> function dblClick(e)
> {
>       var item = getElement("myselector") ;
>       alert("You selected: " + item.value);
> }
>
> and
>
> connect("myselector", "ondblclick", dblClick) ;
>
> What I want to get is the text in the option entry. If someone double-
> clicks on 'csf1r', item.value is set to 0. How do I get the text
> 'csf1r'?
>
> item.text doesn't do it, and nothing I've tried seems to work :-(

item.value should be it, yet I only used it with "onchange" so far. Are you 
sure "ondblclick" is emitted by select-boxes?

Diez

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to