asComponent yields empty form

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

asComponent yields empty form

Jacobsen Jörg
Hi everyone,

I'm trying to code my first Magritte-based form but it persistently refuses to display the input fields.

Here is what I did:

Instance methods on SFCalendar (subclassed from Object):

descriptionPatients
"comment stating purpose of message"
^ MAStringDescription new
selectorAccessor: #patients;
label: 'Patienten';
priority: 90;
default: 'Schnulli, Bulli';
yourself

descriptionStartDate
"comment stating purpose of message"
^ MADateDescription new selectorAccessor: #startDate;
label: 'Beginn am';
priority: 100;
default: (Date today subtractDays: (Date today dayOfMonth - 1));
yourself

and I created the mentioned accessors.

Instance method on the seaside component:

createNewCalendar
"Calendar form"
| calendar |
calendar := self call: (SFCalendar new asComponent addValidatedForm; yourself)

Sending :createNewCalendar yields:

<form accept-charset="utf-8" method="post" action="http://localhost:8090/seaside/Patientenkalender"><div><input name="1" value="Default" style="position: absolute; top: -100em" type="submit" class="submit"/><input name="2" style="position: absolute; top: -100em" type="text" class="text"/></div><table></table><div class="buttons"><input accesskey="S" value="Save" name="3" type="submit" class="submit"/><input accesskey="C" value="Cancel" name="4" type="submit" class="submit"/></div><div><input name="_s" value="upMkEUpoGnxWGUvO" type="hidden" class="hidden"/><input name="_k" value="xxCuTzvW" type="hidden" class="hidden"/></div></form>
So I get some internal (?) input fields off the top of the page and an empty table (which is where I should probably get my input fields?).
Help is greatly appreciated. Joerg.


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

Re: asComponent yields empty form

cedreek
Hi,

2008/4/18, Jacobsen Jörg <[hidden email]>:
> Hi everyone,
>
> I'm trying to code my first Magritte-based form but it persistently refuses
> to display the input fields.
>
> Here is what I did:
>
> Instance methods on SFCalendar (subclassed from Object):

Are they instance side method or class side method ? This must be the latter.

Cédrick


>
>
> descriptionPatients
>  "comment stating purpose of message"
>  ^ MAStringDescription new
>  selectorAccessor: #patients;
>  label: 'Patienten';
>  priority: 90;
>  default: 'Schnulli, Bulli';
>  yourself
>
>
> descriptionStartDate
>  "comment stating purpose of message"
>  ^ MADateDescription new selectorAccessor: #startDate;
>  label: 'Beginn am';
>  priority: 100;
>  default: (Date today subtractDays: (Date today dayOfMonth - 1));
>  yourself
>
> and I created the mentioned accessors.
>
> Instance method on the seaside component:
>
>
> createNewCalendar
>  "Calendar form"
>  | calendar |
>  calendar := self call: (SFCalendar new asComponent addValidatedForm;
> yourself)
>
> Sending :createNewCalendar yields:
>
> <form accept-charset="utf-8" method="post"
> action="http://localhost:8090/seaside/Patientenkalender"><div><input
> name="1" value="Default" style="position: absolute; top: -100em"
> type="submit" class="submit"/><input name="2" style="position: absolute;
> top: -100em" type="text"
> class="text"/></div><table></table><div
> class="buttons"><input accesskey="S" value="Save" name="3" type="submit"
> class="submit"/><input accesskey="C" value="Cancel" name="4" type="submit"
> class="submit"/></div><div><input name="_s"
> value="upMkEUpoGnxWGUvO" type="hidden" class="hidden"/><input name="_k"
> value="xxCuTzvW" type="hidden" class="hidden"/></div></form>
> So I get some internal (?) input fields off the top of the page and an empty
> table (which is where I should probably get my input fields?).
> Help is greatly appreciated. Joerg.
>
>
>  _______________________________________________
>  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: asComponent yields empty form

Jacobsen Jörg
Cédrick, that did the trick.

I thought class or instance wouldn't matter based on what Ramon Leon  
said in his 'Using Magritte with Seaside' blog post.

Thank you, Joerg.



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

RE: asComponent yields empty form

Ramon Leon-5
> Subject: Re: asComponent yields empty form
>
> Cédrick, that did the trick.
>
> I thought class or instance wouldn't matter based on what
> Ramon Leon said in his 'Using Magritte with Seaside' blog post.
>
> Thank you, Joerg.

My bad, I was a bit misleading there, you'd override #description on the
instance side to gather the instance side descriptions to merge with the
class side descriptions.  I'll have to correct that post, it is misleading.

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: asComponent yields empty form

cedreek
In reply to this post by Jacobsen Jörg
2008/4/18, Jacobsen Jörg <[hidden email]>:
> Cédrick, that did the trick.
>
>  I thought class or instance wouldn't matter based on what Ramon Leon
>  said in his 'Using Magritte with Seaside' blog post.

It does by default ;-)

"Generally speaking you'll keep these descriptions on the class side
of your domain object. On occasion, you'll want some property of the
description to be dynamic and depend on the actual value of an
instance side value, so you'll move the description to the instance
side. Strictly speaking, it doesn't matter where you put them,
sometimes you'll use them to build forms when you don't even have a
domain object, but this isn't the normal case."

I think to declare description on the instance side, you need to
modify the DescriptionBuilder so as it looks in the instance side.
Another way is to declare them on the class side and then overide
description on the instance side to copy the default description and
then modify them...


>
>  Thank you, Joerg.
>
>
>
>
>  _______________________________________________
>  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