[Seaside] [FW] Seaside,Scriptaculous and Forms...

Cédrick Béler cbeler at enit.fr
Tue Aug 29 18:31:23 UTC 2006

Hi all :)

Using seaside need sometimes some prerequesites with Html... especially 
with forms

- First rule I wasn't aware is that it's not possible to nest forms 
which can be tempting sometimes... This is a HTML limitation which can 
result in browser being confused and then in impredictable behavior.

- Second rule, all form inputs have to be inside a form tag to be 
submitted to the server... Actually, it has to, because with 
scriptaculous form element's generally don't need to be within a form to 

I had a discussion with Lukas yesterday (list down) about that last 
point as I didn't know if it was good to use form inputs alone... Lukas 
said yes to me and gave me some more information about forms in 
scriptaculous Here are the important points of the discussion:

Is it possible to use certain form elements without forms in scriptaculous ?
It's possible for: text-input, password input, submit buttons, single 
select lists, option buttons   (All single value submitted)
and then you have to use #triggerFormElement: to serialize the state

It's not possible for multi-selection inputs like checkboxes and 
multi-select lists because #triggerFormElement: does not work for them. 
The solution here is to add a form and submit the whole thing for those 
elements using #triggerForm: instead

Why this is not possible ?
This has to do with some magic seaside is doing ;) and which is not 
really compatible the way scriptaculous works.  Seaside uses additional 
hidden fields for checkboxes and multi-select lists that don't get 
triggered properly by scriptaculous (it only triggers the single field 
you specify). The extra hidden fields are needed by seaside to evaluate 
the callbacks properly to make it so conveniant.

How to push something to the server without redrawing? 
(direct acces to the model in the image without any validation)
    SURequest #()
        SUEvaluator #()
    SUUpdater #('id')
        SUAutocompleter #('element')
        SUInPlaceEditor #()
        SUPeriodical #()
request (SURequest)  just posts a request and submits data

... onChanged: (html request triggerForm: 'bla')


updater posts a request, submits data *and* updates some content (used 
in SUClassBrowser to update dynamically the content of the code browser 
of the scriptaculous demo)

evaluator is used to request and inject a javascript into the existing 
page ()


Here it is ;)

Hope that helps other people..


More information about the Seaside mailing list