Create form: from description

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

Create form: from description

dtrussardi@tiscali.it
Hi,
 
i have some classes for define the data to store,  with specific descriptions.
 
All class have the method  descriptionKey for define the key to store the instance.
 
Now i'm interested to create a form with textinput based on one specific descriptionKey.
 
It's possibol ?
 
In WAComponent subclass i have the method:
 
renderAddOn: html
html form:[
                html textInput callback:[ :value| self add: value].
                html submitButtton text:'add'].
       
Now i can render the textInput based on specific descriptionKey ?
 
Any pointers would be greatly appreciated!

Thanks

Dario




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

Re: Create form: from description

Lukas Renggli-2
> In WAComponent subclass i have the method:
>
> renderAddOn: html
> html form:[
>                 html textInput callback:[ :value| self add: value].
>                 html submitButtton text:'add'].
>
> Now i can render the textInput based on specific descriptionKey ?

I don't quite understand what you intend to do with the textInput field.

Do you want to read/write some described data? If so, use something  
like the following:

     object readUsing: description.
     object write: value using: description.

Do you want to use different descriptions depending on some context?  
Use something like:

     self description select: [ :each | each isForContextX ]

> Any pointers would be greatly appreciated!

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: Create form: from description

dtrussardi@tiscali.it
In reply to this post by dtrussardi@tiscali.it
Hi, Lukas

 
>> In WAComponent subclass i have the method:
>>
>> renderAddOn: html
>> html form:[
>>                 html textInput callback:[ :value| self add: value].
>>                 html submitButtton text:'add'].
>>
>> Now i can render the textInput based on specific descriptionKey ?
>
> I don't quite understand what you intend to do with the textInput field.

In other words:
 
 renderAddOn: html
 html form:[
               anMAReferenceModel descriptionKey ....................as ????  changeAccesor ???

                html submitButtton text:'add'].
where anMAReferenceModel is one specific classModel for example:
    MANazionalityModel with specific descriptionKey ->  MAStringDescription new ........ label: 'Nazionaliry name'; ..........
or MAPhoneModel with specific descriptionKey  -> MANumberDescription new  ............label: 'Phone number'; ..... beInteger............
or MA .....  Model  with specific descriptionKey  -> ........
 
 
With this reference i think to have the input set to   relative descriptionKey.
 
I'm clear ?
 
It's possibol ?

Ciao,
Dario


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

Re: Create form: from description

Lukas Renggli-2

On Mar 25, 2008, at 14:15 , Dario Trussardi wrote:

> Hi, Lukas
>
>
> >> In WAComponent subclass i have the method:
> >>
> >> renderAddOn: html
> >> html form:[
> >>                 html textInput callback:[ :value| self add: value].
> >>                 html submitButtton text:'add'].
> >>
> >> Now i can render the textInput based on specific descriptionKey ?
> >
> > I don't quite understand what you intend to do with the textInput  
> field.
>
> In other words:
>
>  renderAddOn: html
>  html form:[
>                anMAReferenceModel  
> descriptionKey ....................as ????  changeAccesor ???
>
>                 html submitButtton text:'add'].
> where anMAReferenceModel is one specific classModel for example:
>     MANazionalityModel with specific descriptionKey ->  
> MAStringDescription new ........ label: 'Nazionaliry name'; ..........
> or MAPhoneModel with specific descriptionKey  -> MANumberDescription  
> new  ............label: 'Phone number'; ..... beInteger............
> or MA .....  Model  with specific descriptionKey  -> ........
>
>
> With this reference i think to have the input set to   relative  
> descriptionKey.
>
> I'm clear ?

No, I don't understand.

I can only guess:

html textInput
     value: (aDescription toString: (object readUsing: aDescription));
     callback: [ :value |  object write: (aDescription fromString:  
value) using: aDescription ].

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: Create form: from description

dtrussardi@tiscali.it
In reply to this post by dtrussardi@tiscali.it
Hi,
 
excuse for my bad english.

> With this reference i think to have the input set to   relative 
> descriptionKey.

>
>I can only guess:
>
>html textInput
>     value: (aDescription toString: (object readUsing: aDescription));
>    callback: [ :value |  object write: (aDescription fromString: 
> value) using: aDescription ].
 
i work with your guess, and some thing go other no.
 
I'have problem with description define using MANumberDescription new ....
 
When, in the textInput digit an char the method  visitNumberDescription: aDescription go in error.
.
And if description is define with addCondition, this are not tested at callback:..
 
 
 
Another  problem about MANumberDescription :
 
    in description based on it, if i define beInteger or min: or max:
    when digit an chart in the UI the method  visitNumberDescription: aDescription go in error.
 
Thank,
 
Dario
 


 
 


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

Re: Create form: from description

Lukas Renggli-2
> >I can only guess:
> >
> >html textInput
> >     value: (aDescription toString: (object readUsing:  
> aDescription));
> >    callback: [ :value |  object write: (aDescription fromString:
> > value) using: aDescription ].
>
> i work with your guess, and some thing go other no.
>
> I'have problem with description define using MANumberDescription  
> new ....

If you decide to have your own interpretation of descriptions, then  
you need to do error handling and validation checking yourself. The  
Magritte-Seaside package does this all automatically for you.

Cheers,
Lukas

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


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