Nevermind: [Zope-DB] Creating Forms

Laura McCord Laura.McCord at doucet-austin.com
Wed Apr 28 10:54:21 EDT 2004


Ok, I figured it out. This is what I had to do. I had to define the
userid used in the <a href..> statement by inserting this line <tr
tal:define="userid result/userid">. Then, I had to put the str(userid)
because without str() it was stating that it could not concatenate a
integer with a string. 

So here is the result:

<div tal:repeat="result batch">
  
         <tr tal:define="userid result/userid">
          <td><span tal:replace="result/userid">userid goes
here</span></td>
          <td><span tal:replace="result/username">username goes
here</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 tal:attributes="href python:
'userEdit_Form?userid=' + str(userid)">[edit]</a></span></td>
        </tr>

  </div>

Thanks,
 Laura

-----Original Message-----
From: zope-db-bounces at zope.org [mailto:zope-db-bounces at zope.org] On
Behalf Of Laura McCord
Sent: Wednesday, April 28, 2004 8:14 AM
To: Charlie Clark; zope-db at zope.org
Subject: RE: [Zope-DB] Creating Forms


Just to clarify some things:

<td><span><a tal:attributes="href python: 'userEdit_Form?userid=' +
userid">[edit]</a></span></td>

 This means that it will take me to the edit form and it attaches the
userid variable to the request. So that is what the ?userid=... means.

<table repeat="result python: context.qUser(userid=userid)">
<tr><td><input type="text" name="userid" 

 I don't understand what qUser is. Could you explain to me what that
means?


Thank you for your help.
 -Laura

-----Original Message-----
From: Charlie Clark [mailto:charlie at begeistert.org] 
Sent: Wednesday, April 28, 2004 3:02 AM
To: Laura McCord
Cc: zope-db at zope.org
Subject: Re: [Zope-DB] Creating Forms


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

_______________________________________________
Zope-DB mailing list
Zope-DB at zope.org
http://mail.zope.org/mailman/listinfo/zope-db



More information about the Zope-DB mailing list