On: Tuesday, January 21, 2003 5:38 PM, Jim Penny wrote:
DTML:
<td><input type="checkbox" name="newmain" <dtml-if main>"checked"</dtml-if >
ZPT: <td><input type="checkbox" name="newmain" tal:condition="checked repeat_var/main">
OK?
Jim
*Sigh* I may have messed this and you up. I am regrouping and looking at what I am trying to do. Jim, that was a very good idea and what it looks like, maybe I should be using Python to grab the data from my db? Neither the DTML or the ZPT worked in this instance. The form I am bringing in the data that has already been saved, it still does not bring in the check...WAIT! should I be saving the value of the checked box, into my table, as "checked" rather than "1"??? or does it even matter. By further explanation: in the Method before this form, where I issue the call to the dbtable to extract an exact article, I save the value of the checkbox (main) to a variable called Main. I then Set the value to Main in the updateArticle_html (my form to view the data). This is the form that I am having the problem with. It seems that where you issue the <input type="checkbox"...> any value stated is what the value of the checkbox is when you write the value out. But when you want to read the value and the checkbox showing as checked is seems that the form needs to be referencing some other function rather then the <input type="checkbox"...> Am I off? Don On Tue, Jan 21, 2003 at 05:12:05PM -0700, Don Brooksby wrote:
I know how to process a form with checkboxes, but when I have stored a value of the checkbox and want to edit it, I can't seem to get it to populate the checkbox in my form.
I have tried to bring in the value of the checkbox, in this case 1 = checked and 0 = not checked. This data was processed in the original form and I saved it to a table in PostgreSQL. I query the table and retrieve the value of the check box. This is where I am hitting my head on that brick wall (about 6' up, dead center).
I can populate the form for editing with everything except the checkboxes; i.e. unique id#, title, written by, article body, etc...
I have even tried to do: <td><input type="checkbox" name="newmain" value="<dtml-var main>"></td>
...so that box will show it checked...I error out.
Have I cleared it up? Don
On Tuesday, January 21, 2003 5:04 PM, Jim Penny Wrote: On Tue, Jan 21, 2003 at 04:42:58PM -0700, Don Brooksby wrote:
I am a 1 year old newbie and 1st time participant to the email group...working on a total website using PostgreSQL in the background. I have hit a wall where help would be appreciated.
In a nut-shell, I have an area where employees can submit articles of industry info for our customers. In that article submission they check off a checkbox denoting what specific customer sub-web they want it published. I then have an area where they can go back in and edit the article or delete totally.
The only problem I have is showing in the checkboxs what was selected when they first submitted the article. Of course when I have the following:
I bring in the value from another DTML Method reading the request from PostgreSQL: <input type=hidden name="main" value="<dtml-var main>">
In the form I have the checkbox show up in the form, but it is not checked if the value pulled from the db is appropriate:
<td><b>Main:</b></td> <td><input type="checkbox" name="newmain" value="1"></td>
I have tested that the value is appropriate, but cannot figure how to show that checkbox as filled if it is supposed to be (1 as checked and 0 as not checked).
I am figuring that Python will be the solution, but if the employee wants to uncheck the box, how is that handled with a dtml instance?
Don: this question is a bit confused.... 1) Do you want to know how to create a form which has a checkbox which is pre-checked depending on the query? 2) Do you want to know how to process forms with checkboxes in them? or 3) both? Jim
Thank you Don Brooksby
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )