AJAX - form

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

AJAX - form

Jakub-8
Hello,

goal is simple login component working with ajax. After click on login button is component validate username and pass and render self.

i take login logic from seaside tutorial something like this:

    html
        form: [html textInput on: #email of: self;
                 value: ''.
            html break.
            html passwordInput
                callback: [:value | self password: value];
                 value: ''.
            html submitButton
                callback: [self validateLogin];
                 text: 'Login']

but submitButton after click call http request and i donw know how change this button's ability. I remove submit button and add simple anchor something like this:

html anchor onClick: (html updater id: 'login'; callback: [:r | self validateLogin. self renderContentOn: r| ]); with: 'login'.

but i have not set self email and pass because i think seaside set my variables after form submit. My question is simple how get value of textInput and passwordInput when i want use anchor and ajax. And second isn't there better way than anchor?

--
Jakub.



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

Re: AJAX - form

Lukas Renggli
> html anchor onClick: (html updater id: 'login'; callback: [:r | self
> validateLogin. self renderContentOn: r| ]); with: 'login'.
>
> but i have not set self email and pass because i think seaside set my
> variables after form submit. My question is simple how get value of
> textInput and passwordInput when i want use anchor and ajax. And second
> isn't there better way than anchor?

You have to tell your updater to trigger the form using #triggerForm:

Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside