"Login" page

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

"Login" page

Richard Eng
I have a login form in which you enter your username and password. Once this information is validated, I want to go to another webpage. How do I do this?
 
Here's my problem code...
 
I render the login form in #renderContentOn: of my main page like so...
 
    html render: login.
 
My login form has the following #renderContentOn: ...
 
renderContentOn: html
 html paragraph: 'Your email address is your username.'.
 self renderStatusMessageOn: html.
 
 html form:
  [html div
   class: 'row';
   with:
    [html span
     class: 'formlabel';
     with: [html text: 'your username'].
    html span
     class: 'forminput';
     with: [html textInput on: #emailAddress of: user]].
  html div
   class: 'row';
   with:
    [html span
     class: 'formlabel';
     with: [html text: 'your password'].
    html span
     class: 'forminput';
     with: [(html textInput type: 'password') on: #password of: user]].
  html div
   class: 'spacer';
   with: ' '.
  html div
   class: 'row';
   with:
    [html span
     class: 'formlabel';
     with: [html text: ''].
    html span
     class: 'forminput';
     with:
      [((html submitButton
       class: 'submit') on: #save of: self) text: 'submit']]]
 
 
On "save" I want to go to another page represented by class #GSServiceCentre. Right now, I have a test statement to verify that this GSServiceCentre page renders correctly:
 
    html anchor callback: [self call: GSServiceCentre new]; with: 'service centre']].
 
I click on "service centre" and it brings me to my desired page. But I want to do this on "save" in my login form. I don't know how to do that. If I simply make a call to #GSServiceCentre like so:
 
    self call: GSServiceCentre new
 
it renders the desired page as a component replacing the login form, which is not what I want.
 
Anyway, I hope I made myself clear. Can anyone help?
 
Thanks.
 
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: "Login" page

Andrius Paulavicius
Pass a callback block [self call: GSServiceCentre new] from you main to login component, and evaluate it with its method "value" when you want it executed.


----- Original Message -----
From: Richard K Eng
To: Seaside - general discussion
Sent: Sunday, July 29, 2007 5:15 PM
Subject: [Seaside] "Login" page


I have a login form in which you enter your username and password. Once this information is validated, I want to go to another webpage. How do I do this?

Here's my problem code...

I render the login form in #renderContentOn: of my main page like so...

    html render: login.

My login form has the following #renderContentOn: ...

renderContentOn: html
 html paragraph: 'Your email address is your username.'.
 self renderStatusMessageOn: html.
 
 html form:
  [html div
   class: 'row';
   with:
    [html span
     class: 'formlabel';
     with: [html text: 'your username'].
    html span
     class: 'forminput';
     with: [html textInput on: #emailAddress of: user]].
  html div
   class: 'row';
   with:
    [html span
     class: 'formlabel';
     with: [html text: 'your password'].
    html span
     class: 'forminput';
     with: [(html textInput type: 'password') on: #password of: user]].
  html div
   class: 'spacer';
   with: ' '.
  html div
   class: 'row';
   with:
    [html span
     class: 'formlabel';
     with: [html text: ''].
    html span
     class: 'forminput';
     with:
      [((html submitButton
       class: 'submit') on: #save of: self) text: 'submit']]]


On "save" I want to go to another page represented by class #GSServiceCentre. Right now, I have a test statement to verify that this GSServiceCentre page renders correctly:

    html anchor callback: [self call: GSServiceCentre new]; with: 'service centre']].

I click on "service centre" and it brings me to my desired page. But I want to do this on "save" in my login form. I don't know how to do that. If I simply make a call to #GSServiceCentre like so:

    self call: GSServiceCentre new

it renders the desired page as a component replacing the login form, which is not what I want.

Anyway, I hope I made myself clear. Can anyone help?

Thanks.

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: "Login" page

Richard Eng
In reply to this post by Richard Eng
"Pass a callback block [self call: GSServiceCentre new] from you main to
login component, and evaluate it with its method "value" when you want it
executed."

How do you do that? I'm not entirely familiar with Smalltalk syntax.

Thanks,
Richard

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

Re: "Login" page

Andrius Paulavicius
Add an instance variable called onSave and its accesor methods to Login
component. When you create you're login component pass it a block:
    login onSave: [self call: GSServiceCentre new].
and in Login components save method evaluate that block:
    onSave value.


> "Pass a callback block [self call: GSServiceCentre new] from you main to
> login component, and evaluate it with its method "value" when you want it
> executed."
>
> How do you do that? I'm not entirely familiar with Smalltalk syntax.
>
> Thanks,
> Richard
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: "Login" page

Richard Eng
In reply to this post by Richard Eng
I was trying to understand why this works. When I coded the block within the
Login component, it did not work. I NOW SEE THE LIGHT!

It comes down to 'self'--which self are you calling method #call: from? It
has to be the main component! Because the callback block has to capture the
main component's context.

What I was doing was wrong because it was capturing the Login component's
context--that's the reason GSServiceCentre was replacing the Login
component! I learned something very important today. What an eye-opener.

Thank you very much.

Regards,
Richard


Andrius Paulavicius wrote:
---------------------------
Add an instance variable called onSave and its accesor methods to Login
component. When you create you're login component pass it a block:
    login onSave: [self call: GSServiceCentre new].
and in Login components save method evaluate that block:
    onSave value.


> "Pass a callback block [self call: GSServiceCentre new] from you main to
> login component, and evaluate it with its method "value" when you want it
> executed."
>
> How do you do that? I'm not entirely familiar with Smalltalk syntax.
>
> Thanks,
> Richard

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

Re: "Login" page

Rajeev Lochan
Well you can check out SmallReddit application made by Ramon Leon at www.onsmalltalk.com

There is a login cum register page, only after successful login or registration, you are re-directed to next component in its  go method

On 7/30/07, Richard K Eng <[hidden email]> wrote:
I was trying to understand why this works. When I coded the block within the
Login component, it did not work. I NOW SEE THE LIGHT!

It comes down to 'self'--which self are you calling method #call: from? It
has to be the main component! Because the callback block has to capture the
main component's context.

What I was doing was wrong because it was capturing the Login component's
context--that's the reason GSServiceCentre was replacing the Login
component! I learned something very important today. What an eye-opener.

Thank you very much.

Regards,
Richard


Andrius Paulavicius wrote:
---------------------------
Add an instance variable called onSave and its accesor methods to Login
component. When you create you're login component pass it a block:
    login onSave: [self call: GSServiceCentre new].
and in Login components save method evaluate that block:
    onSave value.


> "Pass a callback block [self call: GSServiceCentre new] from you main to
> login component, and evaluate it with its method "value" when you want it
> executed."
>
> How do you do that? I'm not entirely familiar with Smalltalk syntax.
>
> Thanks,
> Richard

_______________________________________________
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