[Seaside] Q on "html select" and how to get selected item in an Ajax callback

squeakman squeakman at gmail.com
Thu Oct 13 14:03:27 UTC 2011


Hello All,

Is there a way to get the selectedItem when the Ajax callback is 
triggered in an html select?

The following code snippet works for me but I think there must be a 
better way.

(html select)
   id: 'stocksList';
   list: self listOfStocks;
   onClick: (html scriptaculous request
               callback: [:i |self selectedStockIndex: i asNumber + 1.]
               value: self jsForGetSelectedIndex).


Note that I am using the call:value: method.

The "self jsForGetSelectedIndex" returns the javascript code that gets 
the selected index.

In the callback: I use this returned value to figure out which item was 
selected.

Is there a better way to do this?

Thanks,
Frank



More information about the seaside mailing list