[Zope-DB] Creating Forms
Charlie Clark
charlie at begeistert.org
Wed Apr 28 04:01:55 EDT 2004
I don't know anything about using Formulator - I never quite understood how
to use it myself but a lot of people seem to like it. It's from Maartijn
Faassen and available on zope.org.
However, I think it isn't necessary to solve your problem and it's probably
a good idea to go through the steps of how to do this in Zope with standard
stuff.
All you need to do is to pass some kind of identifier to the edit page in
order to display things; userifd would be good.
Your URL-link would be "user_EditForm?userid=1" for example.
In user_EditForm you can read this id in from the request and pass it to a
ZSQL-Method to get the data. You then use tal:attributes to fill out the
form.
Some snippets:
<td><span><a tal:attributes="href python: 'userEdit_Form?userid=' +
userid">[edit]</a></span></td>
<body tal:define="userid request/userid | nothing>
<form tal:condition="userid">
<table repeat="result python: context.qUser(userid=userid">
<tr><td><input type="text" name="userid"
tal:attributes="value result/userid"
tal:content="result/userid"></td>
</tr>
</table>
</form>
Hope that gets you started. This is essentially TALES work so you might
want to sign up to the ZPT mailing list if you need more help.
Charlie
On 2004-04-27 at 22:07:46 [+0200], Laura McCord wrote:
> I am a newbie at creating forms, I only know the basics. What I need to
> do is the following:
>
> I have a list of users:
>
> 1 jane jane at blah.com texas
> 2 jim jim at blah.com california
> 3 jill jill at blah.com florida
>
> I want the user's name (Example, Jill) to be linkable to an edit form
> but I want the edit form to be pre-populated with the user's
> information. Does anyone have any ideas on how to do this? I am using
> the 'Z Search Interface' to display all of the users.
>
> So, perhaps in this block of code the link can be created. But, I don't
> know what to include to send the user information to the edit form to
> pre-populate the form fields.
>
> <div tal:repeat="result batch" >
>
> <tr>
> <td><span tal:replace="result/userid" >userid</span></td>
> <td><span tal:replace="result/username">username</span></td>
>
> <td><span tal:replace="result/useremail">useremail goes
> here</span></td>
> <td><span tal:replace="result/useroffice">useroffice goes
> here</span></td>
> <td><span tal:replace="result/userpwd">userpwd goes
> here</span></td>
> <td><span tal:replace="result/userpwdchg">userpwdchg goes
> here</span></td>
> <td><span tal:replace="result/pcname">pcname goes
> here</span></td>
> <td><span><a href="userEdit_Form"
> name=username>[edit]</a></span>
> </tr>
> </div>
>
> Thanks,
> Laura
More information about the Zope-DB
mailing list