[Zope3-Users] Customisation of addform

Florian Lindner mailinglists at xgm.de
Sun Nov 28 11:30:05 EST 2004


Roger Ineichen schrieb:
> Hi Florian

Hi!
You sent your email to zope3-users-request at zope.org. It never reached 
the list.

>>-----Original Message-----
>>From: zope3-users-bounces at zope.org 
>>[mailto:zope3-users-bounces at zope.org] On Behalf Of Florian Lindner
>>Sent: Sunday, November 28, 2004 9:48 AM
>>To: zope3-users at zope.org
>>Subject: [Zope3-Users] Customisation of addform
>>
>>Hello,
>>I've a standard addform which looks like that (the HTML 
>>source which was 
>>filled in the body slot of the page macro. (shortened)
>>
>>   <div>
>>   <div>
>>     <form 
>>action="http://localhost:8080/++skin++centershock/eventfolder/
>>+/AddCSEvent.html%3D"
>>           method="post" enctype="multipart/form-data">
>>       <div>
>>         <h3>Add CSEvent</h3>
>>
>>       <div class="row">
>>           <div class="label">
>>             <label for="field.name" title="Short name">Name</label>
>>           </div>
>>           <div class="field"><input class="textType" id="field.name" 
>>name="field.name" size="20" type="text" value=""  /></div>
>>           </div>
>>
>>
>>         <div class="separator"></div>
> 
> 
> Don't forget the widget lookup, otherwise you can't use this zpt as a 
> template attribute in the <addform> directive.
> 
> <div metal:use-macro="context/@@form_macros/widget_rows" />

Sorry, can you explain this a bit more detailed?
You mean, the addform directive is using this
<div metal:use-macro="context/@@form_macros/widget_rows" />
for every row?
So I can define a macro form_macros in the context file. By default 
context == skin_macros but I can change it by changing ZCML 
addform->template. This macro is repeated for each field and the field 
is filled in the widget_rows macro?
Is that right?
Is there a piece of code to see how the addform is being generated? So I 
can see which macros and skin it uses.


> You also can use a own macro an repeat the widgets there. 
> This way you can cutomize the look and feel of the repaeated 
> area of your widgets.

By defining a slot widget_rows in the skin_macro file or the file name 
given in addform->template?


> 
> 
>>         <div class="separator"></div>
>>
>>       </div>
>>       <br /><br />
>>       <div class="row">
>>         <div class="controls"><hr />
>>
>>           <input type="submit" value="Refresh" />
>>           <input type="submit" value="Add"
>>                  name="UPDATE_SUBMIT" />
>>
>>         </div>
>>       </div>
>>
>>       <div class="separator"></div>
>>     </form>
>>   </div>
>>
>>   </div>
>>
>>
>>What possibilities do I have to modify this form?
>>
>>1) Modifiy the page macro, use CSS.
>>2) Using an alternate template (ZCML: template)
>>, maybe using ZCML: class_ for custom widgets.
> 
> 
> The class attribute in the <addform> directive is used for 
> to use another view class for the template.
> 
> You can replace template and class in the <addform>.

I was meaning class_ (with a underscore). But I just see that there is 
no class without underscore. Is there a special meaning in the underscore?
> 
>>3) Changing ZCML: title, menu, label, fields
>>4) ...??
> 
> 
> 5) Use widgets as a subdirective in <addform>
>    for each field.
> 
> 6) Use another 'widget_rows' form macro

6 is the same as described above, isn't it?

Thanks for telling me if my assumptions above are correct.

Best regards,

Florian




More information about the Zope3-users mailing list