[Seaside] Split form
Mariano Martinez Peck
marianopeck at gmail.com
Sun Dec 6 00:11:50 UTC 2015
I hope I am correct with what I say, but I am not 100% sure. I think you
can use Ajax for this. Since you serialize the form you won't need a HTML
form tag at all. That is, no need of HTML form (unless it does not harm if
you want it as for displaying/css things), and instead of using submit
buttons, you use normal buttons with ajax calls and serialization. Example:
html button bePush; onClick: (html jQuery ajax serialize: (html jQuery:
'.formToSubmit' ) script: [ :s | self doSomething.
] ); value: 'Click me'.
The basis here is:
1) use bePush because you are using Ajax and so buttons do NOT have to be
2) The magic here is #serialize: which will serialize and invoke callbacks
for those inputs. And the good thing is that it accepts a jQuery as the
argument of what to serialize. So you can say, for example, all those
elements with css class '.formToSubmit'. And then, when you render forms 1
and 3, you add css class 'formToSubmit'. If the component is very very
large, you can reduce the jquery search for performance (like checking
those elements form AND css class formToSubmit etc...).
3) Note that since this is ajax, you could have a couple of headaches. For
example, doing an #answer: from within the #script: of the ajax call is not
easy. Also, if you are used to normal request, you would re-render
everything automatically. Here, unless you do something inside #script: it
won't refresh anything. So depending on what you need to you may need to
refresh something from there.
If you are used to Ajax this will be very very easy. If you need more help,
let me know.
On Fri, Dec 4, 2015 at 2:05 PM, J.F. Rick <self at je77.com> wrote:
> I'm creating a web interface using seaside that's a bit complicated. One
> particular annoying part is that I have to use multiple forms:
> (1) Form 1 contains some fields
> (2) Form 2 is used for uploading images asynchronously
> (3) Form 3 contains more fields that really belong to Form 1.
> Because of layout and because forms can't be within other forms, I have to
> have both Form 1 and 3, though really they should be the same form that
> uses one submit button. Is there a good way to combine the forms in such a
> way that the callbacks for both forms are evaluated?
> I did notice that the _k are identical for both forms.
> seaside mailing list
> seaside at lists.squeakfoundation.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the seaside