Seaside updater

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|

Seaside updater

Richard Eng
I'm puzzled how to use #updater. I'm trying to use a checkbox to add text to
a textArea input field. For example,...

renderBillingCheckboxAndAddressOn: html
 html div
  class: 'frow';
  with:
   [html break.
   html paragraph:
    [html checkbox
     value: useShippingAddress;
     callback: [:value | useShippingAddress := value];
     onClick: (html updater id: 'shipping';
       callback: [:r | useShippingAddress := useShippingAddress not.
          self renderBillingAddressOn: r] );
     with: 'Use shipping address as billing address also']].
 html div
  class: 'frow';
  with:
   [html span
    class: 'formlabel';
    with: [html text: 'Billing address'].
   html span
    class: 'forminput';
    with: [self renderBillingAddressOn: html]]


This code works, but I'm sure it's not the right way to do things. The
reason I have the 'useShippingAddress := useShippingAddress not' nonsense is
because without it, I can't get #useShippingAddress to have the correct
checkbox value in #renderBillingAddressOn:. The problem is,
#useShippingAddress only gets the correct checkbox value on form submission,
NOT upon invocation of #onClick:.

Ultimately, what I want is for #onClick: to use whatever value is selected
by the form control, whether the control is a checkbox or radio button or
dropdown menu. This *has* to be doable, so the question is:  HOW???

Regards,
Richard

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Seaside updater

Lukas Renggli
>  Ultimately, what I want is for #onClick: to use whatever value is selected
>  by the form control, whether the control is a checkbox or radio button or
>  dropdown menu. This *has* to be doable, so the question is:  HOW???

Please, read the comment in SUAjax of #triggerForm: and #triggerFormElement:.

Also check out the example in SUFormTest.

Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Seaside updater

Richard Eng
In reply to this post by Richard Eng
I looked at the SUFormTest code. It took me into the guts of WARenderCanvas
and WARenderContext where I got totally lost. All this stuff about 'context'
and 'nextKey' and so on is so convoluted. For anyone but a Seaside expert,
this would be unfathomably difficult to use without clear documentation and
simple examples.

A few HowTo's at seaside.st would be very helpful for the rest of us... How
To use #updater, for example (since #updater is a major aspect of Seaside
programming).

Thanks,
Richard

----------------------
Lukas wrote:

>  Ultimately, what I want is for #onClick: to use whatever value is
> selected
>  by the form control, whether the control is a checkbox or radio button or
>  dropdown menu. This *has* to be doable, so the question is:  HOW???

Please, read the comment in SUAjax of #triggerForm: and
#triggerFormElement:.

Also check out the example in SUFormTest.


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Seaside updater

Rajeev Lochan
Hi Richard,
A similar usage of update: has been mentioned in Potsdam univ Seaside Tutorial
http://www.swa.hpi.uni-potsdam.de/seaside/tutorial

HTH,
Rajeev

On Sat, Mar 8, 2008 at 11:36 PM, Richard K Eng <[hidden email]> wrote:
I looked at the SUFormTest code. It took me into the guts of WARenderCanvas
and WARenderContext where I got totally lost. All this stuff about 'context'
and 'nextKey' and so on is so convoluted. For anyone but a Seaside expert,
this would be unfathomably difficult to use without clear documentation and
simple examples.

A few HowTo's at seaside.st would be very helpful for the rest of us... How
To use #updater, for example (since #updater is a major aspect of Seaside
programming).

Thanks,
Richard

----------------------
Lukas wrote:

>  Ultimately, what I want is for #onClick: to use whatever value is
> selected
>  by the form control, whether the control is a checkbox or radio button or
>  dropdown menu. This *has* to be doable, so the question is:  HOW???

Please, read the comment in SUAjax of #triggerForm: and
#triggerFormElement:.

Also check out the example in SUFormTest.


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside



--
Rajeev Lochan

Co-founder, AR-CAD.com

http://www.ar-cad.com
+91 9243468076 (Bangalore)
080 65355873
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Seaside updater

Lukas Renggli
In reply to this post by Richard Eng
> I looked at the SUFormTest code. It took me into the guts of WARenderCanvas
>  and WARenderContext where I got totally lost. All this stuff about 'context'
>  and 'nextKey' and so on is so convoluted. For anyone but a Seaside expert,
>  this would be unfathomably difficult to use without clear documentation and
>  simple examples.

I guess, what you want to do has absolutely nothing to do with
#nextKey. This is just used to create an unique id (as its comment
says).

>  A few HowTo's at seaside.st would be very helpful for the rest of us... How
>  To use #updater, for example (since #updater is a major aspect of Seaside
>  programming).

To trigger a callback of a form elment, you need to specify this form
element with #triggerFormElement:. As the comment of this method says,
this does not work for multi-select lists and checkboxes, as those two
form elements internally depend on another hidden form element. So
four your checkbox you need to trigger the whole form. Give it an
(unique) id and use #triggerForm: with this id.

Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Seaside updater

Gerhard Obermann
In reply to this post by Richard Eng
Hi!
 
I made a quick and dirty example!
 
HTH
Gerhard
 
 | formId |
 formId := html nextId.
 html form id: formId;
  with: [html checkbox value: false; callback: [:v | set := v];
    onClick: (html evaluator triggerForm: formId;
                          callback: [:script | script element id: 'text'; update: [:r | set ifTrue: [r text: 'My address']
                            ifFalse: [r text: '']] ]).
     html textArea id: 'text'; with: [html text: 'Empty']].
 


 
On Sat, Mar 8, 2008 at 4:38 PM, Richard K Eng <[hidden email]> wrote:
I'm puzzled how to use #updater. I'm trying to use a checkbox to add text to
a textArea input field. For example,...

renderBillingCheckboxAndAddressOn: html
 html div
 class: 'frow';
 with:
  [html break.
  html paragraph:
   [html checkbox
    value: useShippingAddress;
    callback: [:value | useShippingAddress := value];
    onClick: (html updater id: 'shipping';
      callback: [:r | useShippingAddress := useShippingAddress not.
         self renderBillingAddressOn: r] );
    with: 'Use shipping address as billing address also']].
 html div
 class: 'frow';
 with:
  [html span
   class: 'formlabel';
   with: [html text: 'Billing address'].
  html span
   class: 'forminput';
   with: [self renderBillingAddressOn: html]]


This code works, but I'm sure it's not the right way to do things. The
reason I have the 'useShippingAddress := useShippingAddress not' nonsense is
because without it, I can't get #useShippingAddress to have the correct
checkbox value in #renderBillingAddressOn:. The problem is,
#useShippingAddress only gets the correct checkbox value on form submission,
NOT upon invocation of #onClick:.

Ultimately, what I want is for #onClick: to use whatever value is selected
by the form control, whether the control is a checkbox or radio button or
dropdown menu. This *has* to be doable, so the question is:  HOW???

Regards,
Richard

_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|

Re: Seaside updater

Gerhard Obermann
Now simplified with updater only!
 
 | formId |
 formId := html nextId.
 html form id: formId;
  with: [html checkbox value: false; callback: [:v | set := v];
    onClick: (html updater id: 'text'; triggerForm: formId;
       callback: [:r | set ifTrue: [r text: 'My address'] ifFalse: [r text: '']]).
     html textArea id: 'text'; with: [html text: 'Empty']].


 
On Sat, Mar 8, 2008 at 7:34 PM, Gerhard Obermann <[hidden email]> wrote:
Hi!
 
I made a quick and dirty example!
 
HTH
Gerhard
 
 | formId |
 formId := html nextId.
 html form id: formId;
  with: [html checkbox value: false; callback: [:v | set := v];
    onClick: (html evaluator triggerForm: formId;
                          callback: [:script | script element id: 'text'; update: [:r | set ifTrue: [r text: 'My address']
                            ifFalse: [r text: '']] ]).
     html textArea id: 'text'; with: [html text: 'Empty']].
 


 
On Sat, Mar 8, 2008 at 4:38 PM, Richard K Eng <[hidden email]> wrote:
I'm puzzled how to use #updater. I'm trying to use a checkbox to add text to
a textArea input field. For example,...

renderBillingCheckboxAndAddressOn: html
 html div
 class: 'frow';
 with:
  [html break.
  html paragraph:
   [html checkbox
    value: useShippingAddress;
    callback: [:value | useShippingAddress := value];
    onClick: (html updater id: 'shipping';
      callback: [:r | useShippingAddress := useShippingAddress not.
         self renderBillingAddressOn: r] );
    with: 'Use shipping address as billing address also']].
 html div
 class: 'frow';
 with:
  [html span
   class: 'formlabel';
   with: [html text: 'Billing address'].
  html span
   class: 'forminput';
   with: [self renderBillingAddressOn: html]]


This code works, but I'm sure it's not the right way to do things. The
reason I have the 'useShippingAddress := useShippingAddress not' nonsense is
because without it, I can't get #useShippingAddress to have the correct
checkbox value in #renderBillingAddressOn:. The problem is,
#useShippingAddress only gets the correct checkbox value on form submission,
NOT upon invocation of #onClick:.

Ultimately, what I want is for #onClick: to use whatever value is selected
by the form control, whether the control is a checkbox or radio button or
dropdown menu. This *has* to be doable, so the question is:  HOW???

Regards,
Richard

_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|

Re: Seaside updater

Richard Eng
In reply to this post by Richard Eng
Thanks to Lukas and Gerhard! This is crystal clear now! It certainly wasn't
from looking at the SUFormTest example.

Works like a charm. With this one post, the entire world of Ajax has opened
up to me!

Regards,
Richard

----------------------
Gerhard wrote:

Now simplified with updater only!

 | formId |
 formId := html nextId.
 html form id: formId;
  with: [html checkbox value: false; callback: [:v | set := v];
    onClick: (html updater id: 'text'; triggerForm: formId;
       callback: [:r | set ifTrue: [r text: 'My address'] ifFalse: [r text:
'']]).
     html textArea id: 'text'; with: [html text: 'Empty']].

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Seaside updater

Richard Eng
In reply to this post by Richard Eng
BTW, for anyone who's interested, I'm currently working on a Seaside-based
online shopping application. It was inspired by the Sushi Store example and
if you look closely, I'll bet you can see what they have in common. To my
knowledge, no other online shopping website works in the manner of my
application:

http://goodsexshopping.com

It is still in alpha development, so there are rough edges and unfinished
functionality. Enjoy.

Regards,
Richard

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Seaside updater

Boris Popov, DeepCove Labs (SNN)
In reply to this post by Richard Eng
Re: [Seaside] Seaside updater

That sounds NSFW...

Cheers!

-Boris (via BlackBerry)

----- Original Message -----
From: [hidden email] <[hidden email]>
To: Seaside - general discussion <[hidden email]>
Sent: Sat Mar 08 12:04:18 2008
Subject: Re: [Seaside] Seaside updater

BTW, for anyone who's interested, I'm currently working on a Seaside-based
online shopping application. It was inspired by the Sushi Store example and
if you look closely, I'll bet you can see what they have in common. To my
knowledge, no other online shopping website works in the manner of my
application:

http://goodsexshopping.com

It is still in alpha development, so there are rough edges and unfinished
functionality. Enjoy.

Regards,
Richard

_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|

Re: Seaside updater

Stefan Schmiedl
On Sat, 8 Mar 2008 12:17:07 -0800
"Boris Popov" <[hidden email]> wrote:

> That sounds NSFW...

But hey, if Seaside is able to handle that kind of load, there's
nothing to worry about :-D

<insert suitable jokes about component-based approach here/>

s.
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Seaside updater

Richard Eng
In reply to this post by Richard Eng
Yes, indeed, I forgot about net etiquette. The project I'm working on (which
includes The Good Sex Network and Good Sex Shopping) is adult-related and
may be verboten at most work sites. However, there is nothing explicit at
these websites, nothing offensive, unless the mere mention of sex is itself
offensive. We live in such an uptight, politically correct society that I
suppose I shouldn't be surprised at the likelihood.

My Seaside project is an example of what a total novice to Smalltalk and OOP
can accomplish with the mere basics of Seaside. I've used nothing fancy,
only what I've found in the tutorials. I'm sure the Seaside experts among
you could achieve much more, but I'm trying to demonstrate what a total noob
like myself can achieve if he isn't afraid to take the road less travelled.

I should mention that this is a one-man project. I work alone(*). No one has
helped me, except for those on the Seaside mailing list, and I thank you
all.

Richard

(*)
- I did all the design work, which included selecting CSS templates from
http://openwebdesign.org
- I chose public domain artwork
- I chose to work exclusively with Open Source and/or free software (this
includes Darwin streaming server for QuickTime)
- I chose WordPress for non-Seaside stuff (such as articles and FAQ)
- I've kept the cost of development to the bare minimum (being the Cheap
Bastard that I am <grin>)

----------------
Boris wrote:

That sounds NSFW...

Cheers!


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Seaside updater

Randal L. Schwartz
>>>>> "Richard" == Richard Eng <[hidden email]> writes:

Richard> I should mention that this is a one-man project. I work alone(*).

No.  I won't go there.  No.

:-)

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[hidden email]> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Seaside updater

stephane ducasse
In reply to this post by Richard Eng
Just out of curiosity. What was your background as programmer and what  
were the ressources that helped you the most
and what you would have love to find but did not?

Stef

On Mar 8, 2008, at 10:09 PM, Richard Eng wrote:

> Yes, indeed, I forgot about net etiquette. The project I'm working  
> on (which
> includes The Good Sex Network and Good Sex Shopping) is adult-
> related and
> may be verboten at most work sites. However, there is nothing  
> explicit at
> these websites, nothing offensive, unless the mere mention of sex is  
> itself
> offensive. We live in such an uptight, politically correct society  
> that I
> suppose I shouldn't be surprised at the likelihood.
>
> My Seaside project is an example of what a total novice to Smalltalk  
> and OOP
> can accomplish with the mere basics of Seaside. I've used nothing  
> fancy,
> only what I've found in the tutorials. I'm sure the Seaside experts  
> among
> you could achieve much more, but I'm trying to demonstrate what a  
> total noob
> like myself can achieve if he isn't afraid to take the road less  
> travelled.
>
> I should mention that this is a one-man project. I work alone(*). No  
> one has
> helped me, except for those on the Seaside mailing list, and I thank  
> you
> all.
>
> Richard
>
> (*)
> - I did all the design work, which included selecting CSS templates  
> from
> http://openwebdesign.org
> - I chose public domain artwork
> - I chose to work exclusively with Open Source and/or free software  
> (this
> includes Darwin streaming server for QuickTime)
> - I chose WordPress for non-Seaside stuff (such as articles and FAQ)
> - I've kept the cost of development to the bare minimum (being the  
> Cheap
> Bastard that I am <grin>)
>
> ----------------
> Boris wrote:
>
> That sounds NSFW...
>
> Cheers!
>
>
> _______________________________________________
> 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
Reply | Threaded
Open this post in threaded view
|

Re: Seaside updater

Richard Eng
In reply to this post by Richard Eng
I'm a semi-retired software engineer. From 1980-2000, I worked for a variety
of companies working in a variety of application domains (database apps,
real-time control, communication software, and device drivers). My last job
was at ATI Technologies (now AMD) as Project Team Leader of the Windows NT
Driver Group.

My very first programming language was Fortran, but most of my career has
been in C. (I dabbled a little bit with C#.)

When I started this project last June, I knew nothing, absolutely nothing,
about web development. I had to bootstrap myself ten different ways,
learning about Linux Server (without a GUI), Apache, DNS, SSL, CSS, HTML,
and video streaming. My work was continually hampered by my aging (read:
failing) memory. (Oh, to be 30, again!)

The resources that helped me most included the few tutorials I could find on
the Internet about Seaside/Squeak, CSS, and Linux, as well as many forum and
blog postings about Apache, PostgreSQL, Darwin streaming server, etc. In
fact, I relied very heavily on these forum postings *but*, and this is a big
'but', far too many of the postings were either obsolete, incomplete,
misleading, or just plain wrong! I've lost count of the number of times I
was supremely frustrated because of this.

One of the BIGGEST headaches I faced was trying to figure out how to do
load-balancing (whether it's with Apache or some other server). Also, I had
a hard time with SSL (and Apache).

Recently, I struggled enormously with DNS and virtual hosts.

All in all, it has been a tremendous and positive learning experience. I am
gratified by all the Seaside people who have contributed excellent blogs
(you know who you are) and tutorials.

What would I have loved to find out but did not? Nothing, really. I
eventually got all my questions answered and issues resolved. However, it
was not without enormous frustration and being led down dead-end trails. I
guess I wish there was a single, well-organized repository of information
that would help people get up to speed quickly and easily with regards to
how to build a Seaside-based website. This would entail:

- How to setup Apache proxy. (In general, how to host your Seaside app on a
Linux server.)

- How to secure your website with SSL.

- How to scale your website with load-balancing.

- How to send out emails from your Seaside app.

- How to load-test and stress-test your website. (A vital issue for
commercial Seaside apps.)

And so on. Much of the information is scattered throughout the Internet and
it is very, very time-consuming to track it all down.

Richard


------------------
Stephane wrote:

Just out of curiosity. What was your background as programmer and what
were the ressources that helped you the most
and what you would have love to find but did not?

Stef


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside