On Sun, 10 December 2000, Martijn Pieters wrote:

> > I am new at programming and have been unable to code a boolean button
> > into my Zope Portal registgration form that can recall the previous
> > selection such that it can be de-selected.  Basically, I want to enable
> > a user on my site to sign-up, flip a boolean on, log out, then later log
> > back in and unflip that boolean.  It's the "unflip" that catches me.  I
> > have been able to make the boolean reflect the fact that it is selected
> > when the user logs back on, back I can't make it unselectable.  Here's
> > the code I've got now that doesn't allow for de-selecting,
> >
> > <input type="checkbox" name="current_college_student"
> >   <dtml-if" member.current_college_student"> 
> >     checked
> >   </dtml-if>
> >    value="member.current_college_student">
> > <b>Current College Student</b>
> > 
> > I guess I need to tell the database that if no value is entered, it
> > should delete "member.current_college_student" from its records.  
> I am not sure what your problem is here. 
> Are you talking about the fact that if the checkbox isn't checked, that
> the browser doesn't send *any* information about the field
> 'current_college_student'?
> If so, you can check for it's absense with the DTML construct '<dtml-unless
> current_college_student> .. </dtml-unless>. Or you could add a hidden form
> field *before* the checkbox which defines a default, empty value, like so:
>   <input type="hidden" name="current_college_student:default" value="">
> You can of course put any other value in there. The browser will always
> pass this back to Zope, and then you can test for the value of
> current_college_student.
> Hope this helps!!

That doesn't quite do it.  Someone joins the network and is taken to a mandatory form 
where they fill in eight pages of information about themself.  They submit the 
information.  Everything's cool up to this point.  

A year later, they graduate from school and become a farmer.  They still want to be a 
member of the network.  They log back in, re-access their form information, deselect 
the checkbox for "student" and select the "professional" checkbox.  I can't get my 
zportal ZODB to recognize the deselection.  You'll notice in the code above that when 
the box is checked and submitted, the value "member._____" is submitted to the 
database.  To display a checked box when the page is re-loaded, I use <dtml-if 
"member.______">checked</dtml-if> within the <inpupt type=boolean...> tag.  

Now, I want to tell the database that if a form page is re-submitted and a boolean box 
that was checked is no longer checked, it's previous value should be deleted from that 
user's record.  

Can anybody shed any light on the matter?  

Robin Lamb

811 Oak St.
San Francisco, CA
phone: 415.241.0441
[EMAIL PROTECTED] is brought to you by 
the Stanford Alumni Association and Critical Path.

Zope maillist  -  [EMAIL PROTECTED]
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-dev )

Reply via email to