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