[Seaside] Scriptaculous example of SUEvaluator ?
florian.minjat at emn.fr
Mon May 21 12:23:25 UTC 2007
Cédrick ENIT wrote:
> Florian Minjat a écrit :
>> I am trying to do a form with validators and confirmation in ajax.
>> All the validation need to be done server-side. My problem is to do
>> something like this in a onClick statement :
>> isFormValid ifTrue: [html updater id: 'formDivId'; callback: [:r
>> | self renderValidFormOn: r]
>> But I need to evaluate isFormValid server-side with an Ajax request
>> because it will only be set as true when the form is validate by ajax.
>> So currently this updater never shows up.
>> I think I could use the SUEvaluator, but couldn't find any example.
>> So I don't really know how to use it.
>> Does somebody know how to do that using as much seaside as possible?
>> And can somebody give me an example of SUEvaluator?
> you have an example in the scriptaculous demo... CSS highlight in the
> ajax tab...
> the pasge if I remember well...
> your problem is because isFormValid is always set to false ?
> maybe after each form input, you need to make a SURequest so as to
> change this...
My problem is that isFormValid must be processed server-side. I could
add an hidden input for each validator and check it at the end but
this is pretty heavy, not very secure, and I still need to add a test
request to get the value to test.
I looked at the example in the demo. SUEvaluator could be the trick to
change the value of an hidden input.
But isn't there a simple way to do something like this :
onClick: ('if (', html ajaxRequest callback: [^ self isFormValid]
,')', html updater... )
More information about the seaside