Seaside 2.9-A2 JQuery serialize forms

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

Seaside 2.9-A2 JQuery serialize forms

John Toohey
Hi,
I have a JQuery Dialog that has a form rendered in it. When the user clicks the "Create" button, I want to serialize the form contents back to the server for validation, and saving in a DB. I want to dialog to stay on the screen until the user clicks "Close"

I have the following code :-

html div id: (id := html nextId);
style: 'display:none';
script: (html jQuery new dialog title: 'Tournaments';
autoOpen: false;
draggable: true;
resizable: false;
width: 1000;
addButton: 'Create' do: (html jQuery ajax serializeForm callback: [self halt]);
addButton: 'Close' do: html jQuery new dialog close);
with: [html render: self createTournamentComponent].

I'm not sure what to pass in as the callback, in order to retrieve the serialized fields. The #callback does not accept any parameters. Just getting started with Seaside, and may be thinking about this in the wrong way. 

Any help would be appreciated.

--
-JT



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

Re: Seaside 2.9-A2 JQuery serialize forms

Lukas Renggli
> addButton: 'Create' do: (html jQuery ajax serializeForm callback: [self
> halt]);
> addButton: 'Close' do: html jQuery new dialog close);
> with: [html render: self createTournamentComponent].
> I'm not sure what to pass in as the callback, in order to retrieve the
> serialized fields. The #callback does not accept any parameters. Just
> getting started with Seaside, and may be thinking about this in the wrong
> way.

#serialize:, #serializeForm, and #serializeThis all do not need a
special callback, they simply trigger the callbacks that you assigned
to your form and form fields. So just write (html jQuery ajax
serializeForm) what will look for all form elements in the enclosing
form and trigger their respective callbacks with the correct values.

Btw, this is exactly the same as with #triggerForm: and
#triggerFormElement: in Scriptaculous.

Cheers,
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 2.9-A2 JQuery serialize forms

John Toohey-2
Thanks for the quick reply. I am using Mold for the field validation, and straight HTML fields (not JQuery form fields. My original form had a submit button to invoke the callback to validate the Mold). Is is possible to add a callback to the #fieldset that will be invoked when I serialize the form, or do I have to use the JQuery form fields and add callbacks to each of them.


On Fri, Feb 6, 2009 at 2:43 PM, Lukas Renggli <[hidden email]> wrote:
> addButton: 'Create' do: (html jQuery ajax serializeForm callback: [self
> halt]);
> addButton: 'Close' do: html jQuery new dialog close);
> with: [html render: self createTournamentComponent].
> I'm not sure what to pass in as the callback, in order to retrieve the
> serialized fields. The #callback does not accept any parameters. Just
> getting started with Seaside, and may be thinking about this in the wrong
> way.

#serialize:, #serializeForm, and #serializeThis all do not need a
special callback, they simply trigger the callbacks that you assigned
to your form and form fields. So just write (html jQuery ajax
serializeForm) what will look for all form elements in the enclosing
form and trigger their respective callbacks with the correct values.

Btw, this is exactly the same as with #triggerForm: and
#triggerFormElement: in Scriptaculous.

Cheers,
Lukas

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



--
-JT

Eolas faoi run ata sa riomhphost seo agus i gceangaltan ar bith ata leis agus is le haghaidh iul agus usaid an te a bhi beartaithe lena fhail agus do siud amhain a sainiodh e. D'fheadfadh an t-eolas seo a bheith faoi reir ag pribhleid dli no ghairmiuil agus go mbeadh cearta sealuchais intleachtuil san aireamh.  Mas amhlaidh nach tu an faighteoir a beartaiodh, ni mor duit gan an teachtaireacht seo na aon chuid de a usaid, a nochtadh, a choipeail, a scaipeadh, na a choimead. Mas tri dhearmad a fuair tu an riomhphost seo cuir e sin in iul don te a sheol chugat e laithreach agus scrios amach gach coip de as do choras riomhaireachta.  Cibe tuairimi a chuirtear in iul sa teachtaireacht seo is leis an seoltoir fein iad ach amhain i gcas go ndeir an seoltoir go sonrach gurbh iad tuairimi ParsPro iad.

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

Re: Seaside 2.9-A2 JQuery serialize forms

Lukas Renggli
On Fri, Feb 6, 2009 at 11:13 PM, John Toohey <[hidden email]> wrote:
> Thanks for the quick reply. I am using Mold for the field validation, and
> straight HTML fields (not JQuery form fields. My original form had a submit
> button to invoke the callback to validate the Mold). Is is possible to add a
> callback to the #fieldset that will be invoked when I serialize the form, or
> do I have to use the JQuery form fields and add callbacks to each of them.

I don't exactly know what you are trying to do: What is Mold? What are
JQuery form fileds?

As long as you use Seaside to render the form fields you can easily
assign callbacks that will be evaluated:

html textInput


 I also don't know Mold and I don't know what JQuery form fields are?




>
> On Fri, Feb 6, 2009 at 2:43 PM, Lukas Renggli <[hidden email]> wrote:
>>
>> > addButton: 'Create' do: (html jQuery ajax serializeForm callback: [self
>> > halt]);
>> > addButton: 'Close' do: html jQuery new dialog close);
>> > with: [html render: self createTournamentComponent].
>> > I'm not sure what to pass in as the callback, in order to retrieve the
>> > serialized fields. The #callback does not accept any parameters. Just
>> > getting started with Seaside, and may be thinking about this in the
>> > wrong
>> > way.
>>
>> #serialize:, #serializeForm, and #serializeThis all do not need a
>> special callback, they simply trigger the callbacks that you assigned
>> to your form and form fields. So just write (html jQuery ajax
>> serializeForm) what will look for all form elements in the enclosing
>> form and trigger their respective callbacks with the correct values.
>>
>> Btw, this is exactly the same as with #triggerForm: and
>> #triggerFormElement: in Scriptaculous.
>>
>> Cheers,
>> Lukas
>>
>> --
>> Lukas Renggli
>> http://www.lukas-renggli.ch
>> _______________________________________________
>> seaside mailing list
>> [hidden email]
>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>
>
> --
> -JT
>
> Eolas faoi run ata sa riomhphost seo agus i gceangaltan ar bith ata leis
> agus is le haghaidh iul agus usaid an te a bhi beartaithe lena fhail agus do
> siud amhain a sainiodh e. D'fheadfadh an t-eolas seo a bheith faoi reir ag
> pribhleid dli no ghairmiuil agus go mbeadh cearta sealuchais intleachtuil
> san aireamh.  Mas amhlaidh nach tu an faighteoir a beartaiodh, ni mor duit
> gan an teachtaireacht seo na aon chuid de a usaid, a nochtadh, a choipeail,
> a scaipeadh, na a choimead. Mas tri dhearmad a fuair tu an riomhphost seo
> cuir e sin in iul don te a sheol chugat e laithreach agus scrios amach gach
> coip de as do choras riomhaireachta.  Cibe tuairimi a chuirtear in iul sa
> teachtaireacht seo is leis an seoltoir fein iad ach amhain i gcas go ndeir
> an seoltoir go sonrach gurbh iad tuairimi ParsPro iad.
>
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>



--
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 2.9-A2 JQuery serialize forms

Lukas Renggli
Oups sorry, that was too fast ...

html textInput
     value: name;
     callback: [ :value | name := value ]

Hope this helps,
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 2.9-A2 JQuery serialize forms

John Toohey-2
Mold, http://kentreis.wordpress.com/2008/08/27/mold-form-validation-for-seaside/, is a form validation utility that I use to perform rule base validation of my form fields. Haven't been able to get it to work with #formSerialize, so I reverted to standard form elements, as you suggested, and it works now. 

I tried to-day to get JQuery autocompleter to work, but I am using 1.6 RC 5 and it does not seem to be supported. The pre-loaded JQuery UI in Seaside is 1.6 RC2, the autocompleter is included there,  and although I can get it to work using only those libs, my theme based forms no longer work. Adding the autocompleter JS code from the preloaded libs to an external JS file, and loading it with RC5 does not work either. 

I guess I should wait for the final Seaside build and the 1.6 release of JQuery-UI to get it all working. 

Thanks for all your help.

On Fri, Feb 6, 2009 at 6:18 PM, Lukas Renggli <[hidden email]> wrote:
Oups sorry, that was too fast ...

html textInput
    value: name;
    callback: [ :value | name := value ]

Hope this helps,
Lukas

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



--
-JT



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

Re: Seaside 2.9-A2 JQuery serialize forms

Lukas Renggli
> Mold, http://kentreis.wordpress.com/2008/08/27/mold-form-validation-for-seaside/,
> is a form validation utility that I use to perform rule base validation of
> my form fields. Haven't been able to get it to work with #formSerialize, so
> I reverted to standard form elements, as you suggested, and it works now.

Was this framework ever updated to Seaside 2.9a2? It probably requires
a few tweaks as it depends on some internal parts of the system.

> I tried to-day to get JQuery autocompleter to work, but I am using 1.6 RC 5
> and it does not seem to be supported. The pre-loaded JQuery UI in Seaside is
> 1.6 RC2, the autocompleter is included there,  and although I can get it to
> work using only those libs, my theme based forms no longer work. Adding the
> autocompleter JS code from the preloaded libs to an external JS file, and
> loading it with RC5 does not work either.
> I guess I should wait for the final Seaside build and the 1.6 release of
> JQuery-UI to get it all working.

jQuery-UI 1.6 final was supposed to be released a few weeks ago. This
still doesn't seem to have happened though. Unfortunately the release
candidate that comes with Seaside 2.9 is (partly) broken with the
final version of jQuery 1.3. It is simply too much work to adapt the
release candidates, I am currently waiting for the final version.

Note that the CSS themes of jQuery-UI were totally overhauled:
<http://blog.jquery.com/2008/12/31/jquery-ui-16rc3-its-getting-really-close/>.
Also note that the AutoCompleter won't be part of jQuery-UI 1.6, this
is only scheduled for 1.7. See http://wiki.jqueryui.com/ for details.

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 2.9-A2 JQuery serialize forms

cedreek


2009/2/9 Lukas Renggli <[hidden email]>
> Mold, http://kentreis.wordpress.com/2008/08/27/mold-form-validation-for-seaside/,
> is a form validation utility that I use to perform rule base validation of
> my form fields. Haven't been able to get it to work with #formSerialize, so
> I reverted to standard form elements, as you suggested, and it works now.

Was this framework ever updated to Seaside 2.9a2? It probably requires
a few tweaks as it depends on some internal parts of the system.


it seems to work ok. I had only to change:

MoldValidationCallback>>priority  from 7 to 3 (less than 5)

trimBlanks is also missing. I change to trimBoth.

Nevertheless, I guess John changed that already.

Cédrick



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

Re: Seaside 2.9-A2 JQuery serialize forms

John Toohey-2
Yep, I changed the priory to 4, and it worked. Still cannot get the Mold callbacks to fire using JQuery, so I have re-done the form without Mold. 

I should probably wait for 1.6 final, and then replace the libraries that shipped with Seaside 2.9-A2.

Smalltalk/Seaside/JQuery is a powerful platform for web apps, but easy to get lost in also.

Thanks for all your help.  

On Mon, Feb 9, 2009 at 7:52 AM, Cédrick Béler <[hidden email]> wrote:


2009/2/9 Lukas Renggli <[hidden email]>

> Mold, http://kentreis.wordpress.com/2008/08/27/mold-form-validation-for-seaside/,
> is a form validation utility that I use to perform rule base validation of
> my form fields. Haven't been able to get it to work with #formSerialize, so
> I reverted to standard form elements, as you suggested, and it works now.

Was this framework ever updated to Seaside 2.9a2? It probably requires
a few tweaks as it depends on some internal parts of the system.


it seems to work ok. I had only to change:

MoldValidationCallback>>priority  from 7 to 3 (less than 5)

trimBlanks is also missing. I change to trimBoth.

Nevertheless, I guess John changed that already.

Cédrick



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




--
-JT



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