Using one Magritte form for two model objects

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

Using one Magritte form for two model objects

Matthias Berth-2
Hi,


I have a big data model that I have split into around 10 model
classes, each with its own set of Magritte descriptions. Now I'd like
to put several of them into a single Magritte form. In other words, I
want to have the form fields of model 1 and model 2 on the same page,
but only one OK and one Cancel button. What would be the simplest way
to do that?

I found this snippet for re-arranging fields / descriptions [1]:

buildComponentFor: aModel
    ^((ModelClass descriptionFieldOne, ModelClass descriptionFieldTwo,
ModelClass descriptionFieldThree)
            componentRenderer: MACssRenderer;
            asComponentOn: aModel)
        addValidatedForm;
        yourself

but it is using a single model object.

Thanks in advance

Matthias

[1] http://onsmalltalk.com/programming/smalltalk/using-magritte-with-seaside/

_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

RE: Using one Magritte form for two model objects

Ramon Leon-5
>
> Hi,
>
>
> I have a big data model that I have split into around 10 model
> classes, each with its own set of Magritte descriptions. Now I'd like
> to put several of them into a single Magritte form. In other words, I
> want to have the form fields of model 1 and model 2 on the same page,
> but only one OK and one Cancel button. What would be the simplest way
> to do that?
>
> I found this snippet for re-arranging fields / descriptions [1]:
>
> buildComponentFor: aModel
>     ^((ModelClass descriptionFieldOne, ModelClass descriptionFieldTwo,
> ModelClass descriptionFieldThree)
>             componentRenderer: MACssRenderer;
>             asComponentOn: aModel)
>         addValidatedForm;
>         yourself
>
> but it is using a single model object.
>
> Thanks in advance
>
> Matthias
>
> [1]
> http://onsmalltalk.com/programming/smalltalk/using-magritte-with-seaside/
>

That same article contains the answer to your question under MAAccessor.

Ramon Leon
http://onsmalltalk.com


_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: Using one Magritte form for two model objects

Lukas Renggli-2
In reply to this post by Matthias Berth-2
> I have a big data model that I have split into around 10 model
> classes, each with its own set of Magritte descriptions. Now I'd like
> to put several of them into a single Magritte form. In other words, I
> want to have the form fields of model 1 and model 2 on the same page,
> but only one OK and one Cancel button. What would be the simplest way
> to do that?

Another possibly to the already suggested one is the following:

Since #asComponent returns a simple Seaside component, you can compose  
several of these components in one Seaside component. You can then  
decorate the parent component with the Magritte form- and validation-
decoration and simply dispatch requests to validate and save to all  
your child components.

Hope this helps?

Cheers,
Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch


_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: Using one Magritte form for two model objects

Matthias Berth-2
In reply to this post by Ramon Leon-5
Ramon,

thanks a lot, that's exactly what I need, it was right in front of my eyes :-/

Matthias

On Thu, Aug 21, 2008 at 7:44 PM, Ramon Leon <[hidden email]> wrote:

>>
>> Hi,
>>
>>
>> I have a big data model that I have split into around 10 model
>> classes, each with its own set of Magritte descriptions. Now I'd like
>> to put several of them into a single Magritte form. In other words, I
>> want to have the form fields of model 1 and model 2 on the same page,
>> but only one OK and one Cancel button. What would be the simplest way
>> to do that?
>>
>> I found this snippet for re-arranging fields / descriptions [1]:
>>
>> buildComponentFor: aModel
>>     ^((ModelClass descriptionFieldOne, ModelClass descriptionFieldTwo,
>> ModelClass descriptionFieldThree)
>>             componentRenderer: MACssRenderer;
>>             asComponentOn: aModel)
>>         addValidatedForm;
>>         yourself
>>
>> but it is using a single model object.
>>
>> Thanks in advance
>>
>> Matthias
>>
>> [1]
>> http://onsmalltalk.com/programming/smalltalk/using-magritte-with-seaside/
>>
>
> That same article contains the answer to your question under MAAccessor.
>
> Ramon Leon
> http://onsmalltalk.com
>
>
> _______________________________________________
> SmallWiki, Magritte, Pier and Related Tools ...
> https://www.iam.unibe.ch/mailman/listinfo/smallwiki
>

_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: Using one Magritte form for two model objects

Matthias Berth-2
In reply to this post by Lukas Renggli-2
Lukas,

thanks a lot, I'll try that as well. I thought that I had to do more
work for this, but it looks simple enough.

Cheers

Matthias

On Thu, Aug 21, 2008 at 10:27 PM, Lukas Renggli <[hidden email]> wrote:

>> I have a big data model that I have split into around 10 model
>> classes, each with its own set of Magritte descriptions. Now I'd like
>> to put several of them into a single Magritte form. In other words, I
>> want to have the form fields of model 1 and model 2 on the same page,
>> but only one OK and one Cancel button. What would be the simplest way
>> to do that?
>
> Another possibly to the already suggested one is the following:
>
> Since #asComponent returns a simple Seaside component, you can compose
> several of these components in one Seaside component. You can then
> decorate the parent component with the Magritte form- and validation-
> decoration and simply dispatch requests to validate and save to all
> your child components.
>
> Hope this helps?
>
> Cheers,
> Lukas
>
> --
> Lukas Renggli
> http://www.lukas-renggli.ch
>
>
> _______________________________________________
> SmallWiki, Magritte, Pier and Related Tools ...
> https://www.iam.unibe.ch/mailman/listinfo/smallwiki
>

_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki