embedded component problem

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

embedded component problem

christian ponti-2
Hi all,
i have always the same issue in different projects:
a component (collectionComponent) render a page divided in two, a box on the left with some button and a list of items, a box on the right which is basically an id to update with an embedded component (cardComponent).
With a (new card) button on the left, the application calls cardComponent wich appears correctly on the right box. The cardComponent is nothing more then a bunch of input text, an upload file form and two buttons (save and cancel).

The following two methods are defined in collectionComponent:

renderNewCardButtonOn: html
   
    (html button)
        onClick:
                ((html updater)
                        id: 'cards';
                        callback: [:r | r render: (self cardComponent: OLCard new)];
                        evalScripts: true);
        text: 'N'

cardComponent: aCard
   
    cardComponent isNil
        ifTrue:
            [cardComponent := OLCardComponent new.
            cardComponent
                card: aCard;
                collection: self collection]
        ifFalse:
            [cardComponent
                card: aCard;
                collection: self collection].
    ^cardComponent


This is the part that manages the file uploading inside cardComponent.

renderImageFileUploadOn: html
   
    html
        tableRow:
            [html
                tableData: 'Copertina';
                tableData:
                        [(html form)
                                multipart;
                                with:
                                        [html fileUpload callback: [:f | coverFile := f].
                                            html break.
                                            html submitButton text: 'Carica']]]

********************************

When I hit the upload file button the form disappears instead of letting the user save the model.


My question: it is possible to have such behaviour or when i use an embedded component (via a JS update) i should expect only to be able to render it?


Christian

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

Re: embedded component problem

Lukas Renggli
As far as I see you have multiple forms on your page. When you upload
a file you only submit the form with the file and thus loose the
contents of the other form. This is the standard behavior of HTTP and
HTML.

You could use #triggerForm: with the updater to submit the other form
to the server. Look for senders of this message to see how it is used.

Cheers,
Lukas


On 12/28/08, christian ponti <[hidden email]> wrote:

> Hi all,
> i have always the same issue in different projects:
> a component (collectionComponent) render a page divided in two, a box on the
> left with some button and a list of items, a box on the right which is
> basically an id to update with an embedded component (cardComponent).
> With a (new card) button on the left, the application calls cardComponent
> wich appears correctly on the right box. The cardComponent is nothing more
> then a bunch of input text, an upload file form and two buttons (save and
> cancel).
>
> The following two methods are defined in collectionComponent:
>
> renderNewCardButtonOn: html
>
>     (html button)
>         onClick:
>                 ((html updater)
>                         id: 'cards';
>                         callback: [:r | r render: (self cardComponent:
> OLCard new)];
>                         evalScripts: true);
>         text: 'N'
>
> cardComponent: aCard
>
>     cardComponent isNil
>         ifTrue:
>             [cardComponent := OLCardComponent new.
>             cardComponent
>                 card: aCard;
>                 collection: self collection]
>         ifFalse:
>             [cardComponent
>                 card: aCard;
>                 collection: self collection].
>     ^cardComponent
>
>
> This is the part that manages the file uploading inside cardComponent.
>
> renderImageFileUploadOn: html
>
>     html
>         tableRow:
>             [html
>                 tableData: 'Copertina';
>                 tableData:
>                         [(html form)
>                                 multipart;
>                                 with:
>                                         [html fileUpload callback: [:f |
> coverFile := f].
>                                             html break.
>                                             html submitButton text:
> 'Carica']]]
>
> ********************************
>
> When I hit the upload file button the form disappears instead of letting the
> user save the model.
>
>
> My question: it is possible to have such behaviour or when i use an embedded
> component (via a JS update) i should expect only to be able to render it?
>
>
> Christian
>


--
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: embedded component problem

christian ponti-2
Hi Lukas


You could use #triggerForm: with the updater to submit the other form
to the server. Look for senders of this message to see how it is used.


thanks for the suggestion, now it works better.
I'll try to experiment a little bit.

Christian

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