<html><body><div style="color:#000; background-color:#fff; font-family:arial, helvetica, sans-serif;font-size:10pt"><div style="font-family: arial, helvetica, sans-serif; font-size: 10pt;">Excellent, it worked great... </div><div style="font-family: arial, helvetica, sans-serif; font-size: 10pt;"><br></div><div style="background-color: transparent;"><div style="color: rgb(0, 0, 0); font-family: arial, helvetica, sans-serif; font-size: 13px; font-style: normal; background-color: transparent;"><font size="2"><span class="Apple-tab-span" style="white-space: pre;">                </span>onSuccess: (</font></div><div style="color: rgb(0, 0, 0); font-family: arial, helvetica, sans-serif; font-size: 13px; font-style: normal; background-color: transparent;"><font size="2"><span class="Apple-tab-span" style="white-space:pre">                </span> (Javascript.JSStream on: 'saveCancelButtonClicked == 0') then: (</font></div><div style="color: rgb(0, 0, 0); font-family:
arial, helvetica, sans-serif; font-size: 13px; font-style: normal; background-color: transparent;"><font size="2"><span class="Apple-tab-span" style="white-space:pre">                                </span>(html jQuery id: 'portalSelectedComponent') load html: [:renderer | </font></div><div style="color: rgb(0, 0, 0); font-family: arial, helvetica, sans-serif; font-size: 13px; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-family: arial, helvetica, sans-serif; font-size: 13px; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-family: arial, helvetica, sans-serif; font-size: 13px; font-style: normal;">...the method that renders the save and cancel buttons contains...</div><div style="color: rgb(0, 0, 0); font-family: arial, helvetica, sans-serif; font-size: 13px; font-style: normal;"><span class="Apple-tab-span" style="font-size: 13px; background-color: transparent; white-space: pre;">        </span><span style="font-size: small;
background-color: transparent;">html script: 'saveCancelButtonClicked = 0;' .</span><br></div><div><div style="color: rgb(0, 0, 0); font-family: arial, helvetica, sans-serif; font-size: 13px; font-style: normal;"><span style="font-size: 13px; background-color: transparent;">...both the save and cancel buttons implement...</span><br></div><div><font size="2"><span class="Apple-tab-span" style="white-space:pre">        </span>onMouseDown: 'saveCancelButtonClicked = 1;'; <br></font></div><div style="color: rgb(0, 0, 0); font-family: arial, helvetica, sans-serif; font-size: 13px; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-family: arial, helvetica, sans-serif; font-size: 13px; font-style: normal;">...works just as I wanted: pressing either the 'Save' or 'Cancel' button after updating an input field triggers the callback on the first click. </div><div style="color: rgb(0, 0, 0); font-family: arial, helvetica, sans-serif;
font-size: 13px; font-style: normal;">And losing focus triggers the input field onBlur action normally. </div><div style="color: rgb(0, 0, 0); font-family: arial, helvetica, sans-serif; font-size: 13px; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-family: arial, helvetica, sans-serif; font-size: 13px; font-style: normal;">Thanks,</div><div style="color: rgb(0, 0, 0); font-family: arial, helvetica, sans-serif; font-size: 13px; font-style: normal;">Bob</div></div></div><div style="font-family: arial, helvetica, sans-serif; font-size: 13px; color: rgb(0, 0, 0); background-color: transparent; font-style: normal;"><span><br></span></div><div style="font-family: arial, helvetica, sans-serif; font-size: 10pt;"><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> "jtuchel@objektfabrik.de" <jtuchel@objektfabrik.de><br> <b><span style="font-weight: bold;">To:</span></b> seaside@lists.squeakfoundation.org <br> <b><span style="font-weight: bold;">Sent:</span></b> Wednesday, April 10, 2013 9:21:52 AM<br> <b><span style="font-weight: bold;">Subject:</span></b> Re: [Seaside] jQuery variable check for onBlur<br> </font> </div> <br>Hi again,<br><br>without having tested it, this may look something like<br><br>onSuccess: (<br> (JSStream on: 'saveCancelButtonClicked == 1')<br> then: ((html jQuery id: 'selectedComponent') load html: <br>[:renderer| self renderSelectedComponentOn: renderer]))<br> else: ....)<br><br>Please let us know how the code ends up looking once you solved. I'd be <br>very interested to learn more about this.<br><br>Joachim<br><br><br>Am 10.04.13
15:09, schrieb <a ymailto="mailto:jtuchel@objektfabrik.de" href="mailto:jtuchel@objektfabrik.de">jtuchel@objektfabrik.de</a>:<br>> Hi Bob,<br>><br>> I guess what you are looking for is JSIfThenElse. I have no example at <br>> hand, but remember two things about it:<br>> * It feels strange to send then:else: to a JSObject. Not very <br>> Smalltalkish.<br>> * It does have a bug that I reported on this list a long time ago. It <br>> only renders the (if) ? then : else; form. So you should change <br>> #javascripContentOn: to<br>><br>> javascriptContentOn: aStream<br>> aStream nextPutAll: 'if('.<br>> super javascriptContentOn: aStream.<br>> aStream nextPutAll: ') {'.<br>> aStream javascript: self trueStatement.<br>> aStream nextPutAll: '} else {'.<br>> aStream javascript: self falseStatement.<br>> aStream
nextPut: $}.<br>><br>> for more complex statements.<br>><br>> In your case, what you need to do first is produce a JSObject that <br>> represents the results of the client-side check <br>> "saveCancelButtonClicked == 1" and send it #then: or #then:else. I'd <br>> be interested in how you can create that JSObject... I guess it's <br>> easy....<br>><br>> Joachim<br>><br>><br>> Am 10.04.13 14:59, schrieb <a ymailto="mailto:bobn@rogers.com" href="mailto:bobn@rogers.com">bobn@rogers.com</a>:<br>>> I posted this on Stack Overflow... no answer so far:<br>>> How do I code a variable check into a Seaside jQuery onSuccess: script?<br>>> I have an application with input fields that trigger a value change <br>>> followed by a re-rendering of the view. It works nicely to provide <br>>> lively feedback of domain data based on displayed values.<br>>> The view shows 'Save' and 'Cancel' buttons
if there are changes <br>>> pending. If the user clicks on either button right after an input <br>>> field, the onBlur: script of the input fields prevents the button <br>>> action from taking place. The recommended solution (button click <br>>> event lost due to the alert box in text box onblur event <br>>> <<a href="http://stackoverflow.com/questions/3245350/button-click-event-lost-due-to-the-alert-box-in-text-box-onblur-event" target="_blank">http://stackoverflow.com/questions/3245350/button-click-event-lost-due-to-the-alert-box-in-text-box-onblur-event</a>>) <br>>> is to use the button's 'onmousedown' event to set a global variable <br>>> that the onBlur script checks.<br>>> With my test code I can see the global 'saveCancelButtonClicked' <br>>> being set, but I don't know how to check the value in order to <br>>> prevent the rendering step.<br>>> |html button<br>>>
onMouseDown: 'saveCancelButtonClicked = 1;'; ...<br>>><br>>> html textInput<br>>> onBlur: ((<br>>> html jQuery ajax<br>>> callback: [:stringValue| self checkValue: stringValue] <br>>> value: html jQuerythis value)<br>>> onSuccess: (<br>>> (html jQuery id: 'selectedComponent') load html: <br>>> [:renderer| renderer script: <br>>> 'console.log(saveCancelButtonClicked);'.<br>>> self renderSelectedComponentOn: renderer]) )]|<br>>> I can see the console.log showing '1' if the save button is pressed. <br>>> So how do I check the value and skip the
'self <br>>> renderSelectedComponentOn:' step?<br>>> It's easy enough to do in javascript (trivial if statement), but I <br>>> have not found an example in Seaside.<br>>> Thanks for any help,<br>>> Bob Nemec<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>> 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>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> </div> </div> </div></body></html>