[Seaside] How to run js on client side using JSScript?

squeakman squeakman at gmail.com
Tue Sep 20 14:57:44 UTC 2011


Hello,

I have a dropdownList using an "html select". When the user clicks on an 
item in the list, I would like to know the index of the selected item.

I am using the callback:value: method to try and get the value of the 
selected index but what I am getting back is the literal string of the 
javascript code.

What do I have to do to get the code 
document.getElementById('listItems').selectedIndex
to be run on the client side and have the results returned to me?


Thanks,
Frank

----- code follows ----


| javaScriptCode |

javaScriptCode := Javascript.JSScript new add:
     'document.getElementById(''listItems'').selectedIndex'; yourself.

(html select)
     id: 'listItems';
     list: dropDownListChoices;
     callback: [:v | ];

     onClick: ((html scriptaculous request)
         triggerForm: (html scriptaculous element up: 'form');
         callback: [:v | self halt]
         value: javaScriptCode )









More information about the seaside mailing list