<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. </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 <pdebruic@gmail.com><br> <b><span style="font-weight: bold;">To:</span></b> bobn@rogers.com; Seaside - general discussion <seaside@lists.squeakfoundation.org> <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>> Hello,<br>> I would like to combine the use of onChange: and onKeyPress: to display<br>> 'Save' & 'Cancel' buttons.<br>> <br>> onChange: is useful when a value is pasted in to the text field, and<br>> onKeyPress: shows the buttons without having to click elsewhere. So far<br>> this is working well, except when the first component selected after<br>> entering text is the 'Save' or 'Cancel' button. When that happens, the<br>> onChange: action is triggered, which re-renders the button. From the<br>> user's perspective, the button press was ignored and needs to be done again.<br>> <br>> I would like to have the onKeyPress: action remove the onChange:<br>>
behaviour. How can that be done?<br>> Or is there a better way to detect that text was pasted in? (i.e. cases<br>> where onKeyPress: is not triggered).<br>> <br>> Here is some sample code... <br>> If you enter a value into the text input field and then press the<br>> button, you'll notice the ignored button press.<br>> <br>> renderContentOn: html<br>> <br>> html form: [<br>> html text: 'Message text:'.<br>> html textInput<br>> value: self messageText; <br>> onChange: (html jQuery ajax callback: [:inputValue | self messageText:<br>> inputValue] value: html jQuery this value);<br>> onChange: ((html jQuery id: 'showThis') load html: [:renderer | self<br>> renderMessageTextAndButtonOn: renderer]);<br>> onKeyPress: (html jQuery ajax callback: [:inputValue | self messageText:<br>> inputValue] value: html jQuery this value);<br>> onKeyPress: ((html jQuery id: 'showThis') load html: [:renderer |
self<br>> renderMessageTextAndButtonOn: renderer]);<br>> yourself.<br>> html horizontalRule.<br>> html div id: 'showThis'; with: [<br>> self renderMessageTextAndButtonOn: html]]<br>> <br>> <br>> renderMessageTextAndButtonOn: html<br>> <br>> html button callback: [Transcript cr; show: 'Button pressed']; with:<br>> 'Press'.<br>> html break.<br>> html text: self messageText asString<br>> <br>> <br>> Thanks, <br>> Bob Nemec<br>> HTS Engineering<br>> <br>> <br>> _______________________________________________<br>> seaside mailing list<br>> <a ymailto="mailto:seaside@lists.squeakfoundation.org" href="mailto:seaside@lists.squeakfoundation.org">seaside@lists.squeakfoundation.org</a><br>> <a href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside" target="_blank">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a><br>> <br><br><br><br> </div> </div>
</div></body></html>