Thank you, Max.
<br/>I learned how to pass a value from one callback to another.
<br/>Sabine
<br/><br/>On Thu, Jul 11, 2013 at 8:26 AM, Max Leske [via Smalltalk]
<br/><<a href="/user/SendEmail.jtp?type=node&node=4698351&i=0" target="_top" rel="nofollow" link="external">[hidden email]</a>> wrote:
<div class='shrinkable-quote'><br/>> Sorry about my first answer. I was at work and wanted to do this quickly.
<br/>> I've posted all the relevant code below.
<br/>>
<br/>> For clarification: this is from Seaside 2.8, the script is Scriptaculous /
<br/>> Prototype (SUObject and subclasses).
<br/>>
<br/>> "aBlock" (as you can see now in the code below) is the secondary callback [
<br/>> :value | self customOrderCount: value asNumberOrZero ]. You can specify
<br/>> multiple secondary callback, but only one primary callback (the primary
<br/>> callback being #callback:, the secondary #callback:value:). The second
<br/>> argument to #callback:value: is a script that will be evaluated on the
<br/>> client side when the event is triggered. The value is then passed into the
<br/>> (secondary) callback block. The primary callback will be evaluated only
<br/>> after all secondary callbacks have been evaluated.
<br/>> The flow is thus the following:
<br/>> 1. get the value of the text input ("(html formElement id: id) value")
<br/>> 2. write that value to a variable (secondary callback)
<br/>> 3. update the content of a <div> according to the changed value (primary
<br/>> callback)
<br/>>
<br/>> "id" is the id of the text input, in this case 'custom-order-amount'.
<br/>> #updateSideContainerOn: simply creates a script that updates a <div> with
<br/>> new information.
<br/>>
<br/>> renderCustomOrderCountBasicOn: html
<br/>> html textInput
<br/>> id: 'custom-order-amount';
<br/>> onKeyUp: (self customOrderCountChangedOn: html).
<br/>> html text: 'Ex.'
<br/>>
<br/>>
<br/>> customOrderCountChangedOn: html
<br/>> ^ self
<br/>> get: 'custom-order-amount'
<br/>> doAndUpdate: [ :value | self customOrderCount: value asNumberOrZero ]
<br/>> on: html
<br/>>
<br/>>
<br/>> get: id doAndUpdate: aBlock on: html
<br/>> ^ (html evaluator
<br/>> callback: [ :script | self updateSideContainerOn: script ];
<br/>> callback: aBlock
<br/>> value: (html formElement id: id) value;
<br/>> yourself) asString
<br/>>
<br/>>
<br/>> updateSideContainerOn: script
<br/>> script add: (script canvas updater
<br/>> id: 'side-container';
<br/>> callback: [ :ajaxHtml | self renderPageRightOn: ajaxHtml ];
<br/>> yourself)
<br/>>
<br/>>
<br/>> Cheers,
<br/>> Max
<br/>>
<br/>>
<br/>> On 10.07.2013, at 11:26, Sabine Knöfel <[hidden email]> wrote:
<br/>>
<br/>> Hi Max,
<br/>>
<br/>> thanks. 3 questions:
<br/>> 1) what is in aBlock?
<br/>> 2) is id the id of the textInput?
<br/>> 3) can you send (the relevant part) of updateSideContainerOn?
<br/>>
<br/>> Sabine
<br/>>
<br/>> On Wed, Jul 10, 2013 at 11:04 AM, Max Leske [via Smalltalk]
<br/>> <<a
<br/>> href="x-msg://2268/user/SendEmail.jtp?type=node&amp;node=4698123&amp;i=0"
<br/>> target="_top" rel="nofollow" link="external">[hidden email]> wrote:
<br/>>
<br/>>> Hi Sabine
<br/>>>
<br/>>> We use some similar code. I simply copied it from our productive
<br/>>> environment, so you'll have to figure out the details for yourself :)
<br/>>> #customOrderCountChangedOn: basicly answers the script I pasted second.
<br/>>>
<br/>>> html textInput
<br/>>> id: 'custom-order-amount';
<br/>>> onKeyUp: (self customOrderCountChangedOn: html).
<br/>>>
<br/>>> (html evaluator
<br/>>> callback: [ :script | self updateSideContainerOn: script
<br/>>> ];
<br/>>> callback: aBlock
<br/>>> value: (html formElement id: id) value;
<br/>>> yourself) asString
<br/>>>
<br/>>> HTH (ask again if you're having troubles),
<br/>>> Max
<br/>>>
<br/>>> On 10.07.2013, at 10:35, Sabine Knöfel <[hidden email]> wrote:
<br/>>>
<br/>>>> Hi,
<br/>>>>
<br/>>>> in a "register new user" page, I have a textInput where I want to check
<br/>>>> the
<br/>>>> validity of an email address each time the user types in one character.
<br/>>>> If
<br/>>>> the email adress is valid, the "register" button should enable.
<br/>>>>
<br/>>>> How would you do this? Does anybody have a text snippet for me?
<br/>>>>
<br/>>>> html textInput
<br/>>>> ....
<br/>>>> onKeyUp: ????
<br/>>>>
<br/>>>> Sabine
<br/>>>>
<br/>>>>
<br/>>>>
<br/>>>> --
<br/>>>> View this message in context:
<br/>>>> <a href="http://forum.world.st/onKeyUp-do-check-and-enable-button-tp4698098.html" target="_top" rel="nofollow" link="external">http://forum.world.st/onKeyUp-do-check-and-enable-button-tp4698098.html</a><br/>>>> Sent from the Seaside General mailing list archive at Nabble.com.
<br/>>>> _______________________________________________
<br/>>>> seaside mailing list
<br/>>>> [hidden email]
<br/>>>> <a href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside" target="_top" rel="nofollow" link="external">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a><br/>>>
<br/>>> _______________________________________________
<br/>>> seaside mailing list
<br/>>> [hidden email]
<br/>>> <a href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside" target="_top" rel="nofollow" link="external">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a><br/>>>
<br/>>>
<br/>>> ________________________________
<br/>>> If you reply to this email, your message will be added to the discussion
<br/>>> below:
<br/>>>
<br/>>> <a href="http://forum.world.st/onKeyUp-do-check-and-enable-button-tp4698098p4698113.html" target="_top" rel="nofollow" link="external">http://forum.world.st/onKeyUp-do-check-and-enable-button-tp4698098p4698113.html</a><br/>>> To unsubscribe from onKeyUp: -> do check and enable button, click here.
<br/>>> NAML
<br/>>
<br/>> ________________________________
<br/>> View this message in context: Re: onKeyUp: -> do check and enable button
<br/>>
<br/>> Sent from the Seaside General mailing list archive at Nabble.com.
<br/>> _______________________________________________
<br/>> seaside mailing list
<br/>> [hidden email]
<br/>> <a href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside" target="_top" rel="nofollow" link="external">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a><br/>>
<br/>>
<br/>>
<br/>> _______________________________________________
<br/>> seaside mailing list
<br/>> [hidden email]
<br/>> <a href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside" target="_top" rel="nofollow" link="external">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a><br/>>
<br/>>
<br/>> ________________________________
<br/>> If you reply to this email, your message will be added to the discussion
<br/>> below:
<br/>> <a href="http://forum.world.st/onKeyUp-do-check-and-enable-button-tp4698098p4698303.html" target="_top" rel="nofollow" link="external">http://forum.world.st/onKeyUp-do-check-and-enable-button-tp4698098p4698303.html</a><br/>> To unsubscribe from onKeyUp: -> do check and enable button, click here.
<br/>> NAML
<br/></div>
        
        
        
<br/><hr align="left" width="300" />
View this message in context: <a href="http://forum.world.st/onKeyUp-do-check-and-enable-button-tp4698098p4698351.html">Re: onKeyUp: -> do check and enable button</a><br/>
Sent from the <a href="http://forum.world.st/Seaside-General-f86180.html">Seaside General mailing list archive</a> at Nabble.com.<br/>