<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>onInput: works great; exactly what I needed.&nbsp;</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>Thank you.</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>Bob</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> Wednesday, January 9, 2013 11:47:09 AM<br> <b><span style="font-weight: bold;">Subject:</span></b> Re: [Seaside] jQuery onChange: and onKeyPress:<br> </font> </div> <br>Depending on what browsers you have to support you could just use the<br>HTML5 onInput event rather than both onKeyPress and onChange. See the<br>following for a list of browsers that support it:<br><a href="https://developer.mozilla.org/en-US/docs/DOM/window.oninput"
 target="_blank">https://developer.mozilla.org/en-US/docs/DOM/window.oninput</a><br><br>Its part of the Seaside-HTML5 package<br><br><br><br>On 01/09/2013 06:58 AM, <a ymailto="mailto:bobn@rogers.com" href="mailto:bobn@rogers.com">bobn@rogers.com</a> wrote:<br>&gt; Hello,<br>&gt; I would like to combine the use of onChange: and onKeyPress: to display<br>&gt; 'Save' &amp; 'Cancel' buttons.<br>&gt; <br>&gt; onChange: is useful when a value is pasted in to the text field, and<br>&gt; onKeyPress: shows the buttons without having to click elsewhere. So far<br>&gt; this is working well, except when the first component selected after<br>&gt; entering text is the 'Save' or 'Cancel' button. When that happens, the<br>&gt; onChange: action is triggered, which re-renders the button. From the<br>&gt; user's perspective, the button press was ignored and needs to be done again.<br>&gt; <br>&gt; I would like to have the onKeyPress: action remove the onChange:<br>&gt;
 behaviour.&nbsp; How can that be done?<br>&gt; Or is there a better way to detect that text was pasted in? (i.e. cases<br>&gt; where onKeyPress: is not triggered).<br>&gt; <br>&gt; Here is some sample code... <br>&gt; If you enter a value into the text input field and then press the<br>&gt; button, you'll notice the ignored button press.<br>&gt; <br>&gt; renderContentOn: html<br>&gt; <br>&gt; html form: [<br>&gt; html text: 'Message text:'.<br>&gt; html textInput<br>&gt; value: self messageText; <br>&gt; onChange: (html jQuery ajax callback: [:inputValue | self messageText:<br>&gt; inputValue] value: html jQuery this value);<br>&gt; onChange: ((html jQuery id: 'showThis') load html: [:renderer | self<br>&gt; renderMessageTextAndButtonOn: renderer]);<br>&gt; onKeyPress: (html jQuery ajax callback: [:inputValue | self messageText:<br>&gt; inputValue] value: html jQuery this value);<br>&gt; onKeyPress: ((html jQuery id: 'showThis') load html: [:renderer |
 self<br>&gt; renderMessageTextAndButtonOn: renderer]);<br>&gt; yourself.<br>&gt; html horizontalRule.<br>&gt; html div id: 'showThis'; with: [<br>&gt; self renderMessageTextAndButtonOn: html]]<br>&gt; <br>&gt; <br>&gt; renderMessageTextAndButtonOn: html<br>&gt; <br>&gt; html button callback: [Transcript cr; show: 'Button pressed']; with:<br>&gt; 'Press'.<br>&gt; html break.<br>&gt; html text: self messageText asString<br>&gt; <br>&gt; <br>&gt; Thanks, <br>&gt; Bob Nemec<br>&gt; HTS Engineering<br>&gt; <br>&gt; <br>&gt; _______________________________________________<br>&gt; seaside mailing list<br>&gt; <a ymailto="mailto:seaside@lists.squeakfoundation.org" href="mailto:seaside@lists.squeakfoundation.org">seaside@lists.squeakfoundation.org</a><br>&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; <br><br><br><br> </div> </div> 
 </div></body></html>