How do I... use a python script to pre-fill the value of a form's field? I am setting a field in the request, but it appears in the 'other' section of the request. Page Template - html form ------------------------------- <html> <body> <form method="POST" action=""> Enter text: <input name="aformfield" type="text" value="" /> <input type="submit" name="form.button.submit" value="Submit" /> </form> <br /><br /><br /> <p tal:content="structure request">stuff</p> </body> </html> Python Script ------------------------------- #Get the HTML request object myrequest = container.REQUEST #preset the request field myrequest.set('aformfield', 'a value') #go to the form return context.theform(REQUEST=myrequest) Note: I am actually trying to pre-fill a CMFformcontroller template in plone 2.0. However, if I can't get this most simple example to work... Many thanks in advance.
On Mon, Feb 23, 2004 at 01:15:11PM -0500, AdvertisingDept wrote:
How do I... use a python script to pre-fill the value of a form's field?
You just check the request in the template.
I am setting a field in the request, but it appears in the 'other' section of the request.
Doesn't matter.
Page Template - html form ------------------------------- <html> <body> <form method="POST" action=""> Enter text: <input name="aformfield" type="text" value="" />
Try something like: <input name="aformfield" type="text" value="" tal:attributes="value request/aformfield | default" /> -- Paul Winkler http://www.slinkp.com Look! Up in the sky! It's MEGA RAR-PUMA! (random hero from isometric.spaceninja.com)
participants (2)
-
AdvertisingDept -
Paul Winkler