javascript / python /populate fields from db
Hi all, This list is really wonderful, as I can solve most of my issues so fast, that I am amazed. Well I need more help... My requirement is to populate three fields (coming from formulator) in a ZPT file. The first field has a drop down and should get data from db using pyhton. The next 2 fields should populate themselves with the corresponding columns from the database. It seems to me that javascript is the only choice? Am I correct in this assumption? If yes, are there any options on how to use it in this scenario? Does python (server side) "talk" directly to javascript(client side)? Maybe python generates the javascript on the fly? Are you aware of any examples using this approach on the web? Any comments would be helpful... Thanks Harish ________________________________________________________________________ Send free SMS using the Yahoo! Messenger. Go to http://in.mobile.yahoo.com/new/pc/
My requirement is to populate three fields (coming from formulator) in a ZPT file. The first field has a drop down and should get data from db using pyhton. The next 2 fields should populate themselves with the corresponding columns from the database
Not sure why you would need Javascript. I'm assuming you have a formulator form that you need to render using ZPT. Three fields in the form have values from a database that is filled in. You can use field.render(value=whatever, request=request.REQUEST) from Formulator to fill in the values of the form. eg: A python script gets all the values from a database or any other place and returns a dictionary like {'fieldid':value...}. Let us call this get_prefill_values(). So your ZPT will be, for Formulator form with id `form`: <div tal:define="prefill here/get_prefill_values"> <div tal:repeat="field here/form/get_fields"> <span tal:replace="structure python:field.render(value=prefill[field.id])"/> </div> </div> HTH -- Vattekkat S Babu http://vsbabu.org/
participants (2)
-
Exteam -
Satheesh Babu