<html><body><div style="color:#000; background-color:#fff; font-family:arial, helvetica, sans-serif;font-size:10pt"><div><span>Paul,</span></div><div style="color: rgb(0, 0, 0); font-size: 13px; font-family: arial, helvetica, sans-serif; background-color: transparent; font-style: normal;"><span>Thanks for all the work. This is not something I would have figured out on my own.</span></div><div style="color: rgb(0, 0, 0); font-size: 13px; font-family: arial, helvetica, sans-serif; background-color: transparent; font-style: normal;"><span><br></span></div><div style="color: rgb(0, 0, 0); font-size: 13px; font-family: arial, helvetica, sans-serif; background-color: transparent; font-style: normal;"><span>In my example the list is now rendered after the first click and displayed on the second click, so from the user's point of view two clicks are needed to get the rendered list. &nbsp;That kind of makes sense, since the first click triggers the 'click' event
 to build the selection list. Would there be a way to have the list displayed after build, rather than waiting for the second click?</span></div><div style="color: rgb(0, 0, 0); font-size: 13px; font-family: arial, helvetica, sans-serif; background-color: transparent; font-style: normal;"><span><br></span></div><div style="color: rgb(0, 0, 0); font-size: 13px; font-family: arial, helvetica, sans-serif; background-color: transparent; font-style: normal;"><span>Are you seeing the same click sequence? If not I'll go through my code more carefully.</span></div><div style="color: rgb(0, 0, 0); font-size: 13px; font-family: arial, helvetica, sans-serif; background-color: transparent; font-style: normal;"><span><br></span></div><div style="color: rgb(0, 0, 0); font-size: 13px; font-family: arial, helvetica, sans-serif; background-color: transparent; font-style: normal;"><span>I've tried the code first in VW 7.7.1 with Seaside 3.0 and again in the current Pharo
 one-click image with Seaside 3.0.7</span></div><div style="color: rgb(0, 0, 0); font-size: 13px; font-family: arial, helvetica, sans-serif; background-color: transparent; font-style: normal;"><span><br></span></div><div style="color: rgb(0, 0, 0); font-size: 13px; font-family: arial, helvetica, sans-serif; background-color: transparent; font-style: normal;"><span style="background-color: transparent;">Thanks again,</span><br></div><div style="color: rgb(0, 0, 0); font-size: 13px; font-family: arial, helvetica, sans-serif; background-color: transparent; font-style: normal;">Bob</div><div style="color: rgb(0, 0, 0); font-size: 13px; font-family: arial, helvetica, sans-serif; background-color: transparent; font-style: normal;"><span><br></span></div><div><br></div>  <div style="font-family: arial, helvetica, sans-serif; font-size: 10pt;"> <div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt;"> <div dir="ltr"> <font size="2"
 face="Arial"> <hr size="1">  <b><span style="font-weight:bold;">From:</span></b> Paul DeBruicker &lt;pdebruic@gmail.com&gt;<br> <b><span style="font-weight: bold;">To:</span></b> bobn@rogers.com; Seaside - general discussion &lt;seaside@lists.squeakfoundation.org&gt; <br> <b><span style="font-weight: bold;">Sent:</span></b> Thursday, February 28, 2013 12:46:52 PM<br> <b><span style="font-weight: bold;">Subject:</span></b> Re: [Seaside] build drop-down select list when clicked<br> </font> </div> <br>I figured out the rest of it. The original callback from the select<br>doesn't do anything with the value from the expanded list.&nbsp; If you add a<br>hiddenInput after the select and serialize that with the selected value<br>of the select when the select changes, then things work nicely.<br><br>So change the renderSelect: method to<br><br>MyClass&gt;&gt;renderSelect:html<br>&nbsp;&nbsp;&nbsp; html select<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; id: html
 lastId;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; list: (Array with: self timeZone key);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; script: (self loadSelectListOnceFor: html lastId on: html);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; onChange: (self serializeHiddenInput: 'tzId' withValueFrom: html<br>lastId on: html);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; selected: self timeZone key<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; html hiddenInput<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; id: 'tzId';<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; callback: [ :val | self timeZone: (Timezone at: val) ].<br><br><br>and add<br><br>MyClass&gt;&gt;serializeHiddenInput: anId withValueFrom: selectId on: html<br>&nbsp;&nbsp;&nbsp; ^ ((html jQuery id: anId) value: ((html jQuery id: selectId) find:<br>'option:selected') contents text)<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; , (html jQuery ajax serialize: (html jQuery id: anId))<br><br><br><br><br>On
 02/27/2013 09:24 PM, Paul DeBruicker wrote:<br>&gt; I haven't figured out how to get the browser to recognize the changed<br>&gt; value for the select, so the callback get the updated value if the user<br>&gt; changes their choice.&nbsp; Probably need to clone the select after adding<br>&gt; the options then replace the original with the new version.&nbsp; I'm not<br>&gt; sure yet.&nbsp; But it would be handy to know.&nbsp; So it needs some work but<br>&gt; what I outline below loads a bunch of &lt;option&gt; tags into the &lt;select&gt;<br>&gt; and serializes the select onChange: to the callback.&nbsp; Just not the value<br>&gt; the user chooses yet.<br>&gt; <br>&gt; <br>&gt; To load new select items into the select menu you need to create the<br>&gt; &lt;option&gt; tags that comprise the select list and then stick them in there.<br>&gt; <br>&gt; Assuming your list is the Chronos list of Timezone keys you could do it<br>&gt; like this:<br>&gt; <br>&gt;
 MyClass&gt;&gt;renderSelect: html<br>&gt; &nbsp;&nbsp;&nbsp; html select<br>&gt; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; id: html lastId;<br>&gt; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; list: (Array with: self timeZone key);<br>&gt; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; script: (self loadSelectListOnce: html);<br>&gt; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; onChange: html jQuery post serializeThis;<br>&gt; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; selected: self timeZone key;<br>&gt; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; callback: [ :val | self timeZone: (Timezone at: val) ].<br>&gt; <br>&gt; MyClass&gt;&gt;loadSelectListOnceFor: anId on: html<br>&gt; &nbsp;&nbsp;&nbsp; ^ (html jQuery id: anId)<br>&gt; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; one: 'click'<br>&gt; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; do:<br>&gt; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; (html jQuery ajax<br>&gt; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
 &nbsp;&nbsp;&nbsp; html: [ :h | self renderTimeZoneList: h ];&nbsp;&nbsp;&nbsp; <br>&gt; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; onSuccess: (self loadOptionsInto: anId on: html))<br>&gt; <br>&gt; <br>&gt; MyClass&gt;&gt;renderTimeZoneList:html<br>&gt; &nbsp;&nbsp;&nbsp; Timezone allRegisteredKeys asSortedCollection<br>&gt; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; doWithIndex: [ :eachTimeZone :index |<br>&gt; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; html option<br>&gt; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; value: index + 1;<br>&gt; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; with: eachTimeZone ]<br>&gt; <br>&gt; MyClass&gt;&gt;loadOptionsInto: anId on: html<br>&gt; &nbsp;&nbsp;&nbsp; ^ (JSStream<br>&gt; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; on:'$("#' , anId ,' option:first").after(data)') asFunction: #('data'<br>&gt; 'status'
 'jqXhr')<br>&gt; <br>&gt; <br>&gt; <br>&gt; Good luck<br>&gt; <br>&gt; <br>&gt; Paul<br>&gt; <br>&gt; <br>&gt; <br>&gt; On 02/27/2013 08:52 AM, <a ymailto="mailto:bobn@rogers.com" href="mailto:bobn@rogers.com">bobn@rogers.com</a> wrote:<br>&gt;&gt; Hello,<br>&gt;&gt; Is there a way to build the 'select' list when the drop-down button is<br>&gt;&gt; pressed?<br>&gt;&gt;<br>&gt;&gt; Our application uses drop-down lists for options that have a short list<br>&gt;&gt; to pick from (longer lists use a lightbox list prompt).<br>&gt;&gt; In most cases, the list of values is not needed, since the user is not<br>&gt;&gt; going to change the selection. <br>&gt;&gt; So, I'd prefer to defer getting the list to when the user asks for it<br>&gt;&gt; (round trip time to get the list is less than 50ms).<br>&gt;&gt; Getting the data is not expensive, but including it in the initial data<br>&gt;&gt; retrieval for the full view is a coding hassle. <br>&gt;&gt;<br>&gt;&gt;
 I've tried various #onClick: code, like loading a new rendering of the<br>&gt;&gt; select component with the list populated, but no luck.<br>&gt;&gt;<br>&gt;&gt; i.e.<br>&gt;&gt; html select<br>&gt;&gt; onClick: ("get the list and display it");<br>&gt;&gt; list: (Array with: initialSelection); "for initial display"<br>&gt;&gt; selected: initialSelection; <br>&gt;&gt; callback: [:value | ... ]<br>&gt;&gt; Thanks for any help,<br>&gt;&gt; Bob Nemec<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt; _______________________________________________<br>&gt;&gt; seaside mailing list<br>&gt;&gt; <a ymailto="mailto:seaside@lists.squeakfoundation.org" href="mailto:seaside@lists.squeakfoundation.org">seaside@lists.squeakfoundation.org</a><br>&gt;&gt; <a href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside" target="_blank">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a><br>&gt;&gt;<br>&gt; <br><br><br><br> </div> </div> 
 </div></body></html>