Re: Split form

Mariano Martinez Peck <[email protected]>
Newsgroups gmane.comp.lang.smalltalk.squeak.seaside
Message-ID <CAA+-=mWsUx-fwt3Oee9WYc4Wr86=S=fc=dwt-CW89wyJe-Nozg@mail.gmail.com>
Hi Jeff,

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
submit.
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 <[email protected]> wrote:

> Hi,
>
> 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.
>
> Cheers,
>
> Jeff
>
> _______________________________________________
> seaside mailing list
> [email protected]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>


-- 
Mariano
http://marianopeck.wordpress.com

_______________________________________________
seaside mailing list
[email protected]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.