<P>Hi, </P>
<P>I am looking for a solution to the problem of using both editing and adding using formulator. Ran into the following page, on the web, which asks the same question so well, that I am just quoting it here. </P>
<P>U can find it in the following link:</P>
<P><A href="http://www.geocrawler.com/archives/3/12572/2002/11/0/10166843/">http://www.geocrawler.com/archives/3/12572/2002/11/0/10166843/</A></P>
<P>The problem is as follows:</P>
<P>How do people structure and name their Formulator forms and Zope trees so<BR>the same form can be shared between add and edit functions? For example, if<BR>I have an SQL table like so:<BR><BR> create table person (<BR> last_name character varying(80),<BR> first_name character varying(80),<BR> middle_name character varying(80),<BR> ssn character varying(80),<BR> email character varying(80)<BR> );<BR><BR>I'd like the same form to be usable for both adding new people and editing<BR>the information for people already in the database. I'm using page<BR>templates, so that might make a difference as well. Currently, I have a<BR>structure which looks like this<BR><BR>
person<BR> form<BR> add<BR> index_html<BR> input_form<BR> do_action<BR> edit<BR> index_html<BR> input_form<BR> do_action<BR><BR>where "form" is a Formulator object, index_html displays either a blank or<BR>filled in form using input_form, and do_action performs the necessary<BR>database insert or update operations. Where should my form go and how<BR>should I refer to fields? Though I use a single Formulator form, I wind up<BR>duplicating the actual HTML
<form> (in input_form) because in one case I use<BR>the Formulator defaults and in the other case I fill in values for the<BR>fields dredged from my database. In my add <form>:<BR><BR> <th class="form-label"<BR> tal:content="python: here.utils.field_title(here.form.city)">title</th><BR> <td tal:content="structure here/form/city/render">item</td><BR><BR>In my edit <form>:<BR><BR> <th class="form-label"<BR> tal:content="python: here.utils.field_title(here.form.city)">title</th><BR> <td tal:content="structure python: here.form.city.render(options['city'])">item</td><BR><BR>Lots of duplication, as you might imagine.<BR><BR>Also, do I need to use python: to pass a parameter to here/form/city/render<BR>or can I do that somehow from ptl?<BR><BR>I realize this is probably more of a page template question, but you folks<BR>are the ones
who must want to share your forms, so I thought you'd have more<BR>direct experience.<BR></P>
<P>===========</P>
<P>looking forward for a quick response..</P>
<P>Regards</P>
<P>Subhankar</P>
<P> </P><p><font face=arial size=-1><img src="http://in.yimg.com/i/in/mobile/pctomob.gif" width=28 height=22 border=0 alt="Yahoo! India Mobile"></a>
<a href="http://in.mobile.yahoo.com/new/pc/" target="_blank"><b>SMS</b></a> using the Yahoo!
<a href="http://in.mobile.yahoo.com/new/pc/"><b>Messenger</a>;</b></font>
<font face=arial size=-1><b>
<a href="http://in.messenger.yahoo.com/">Download</b></a> latest version.</font>