cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Price <simon.pr...@bristol.ac.uk>
Subject Re: SUMMARY: how to use a checkbox with DatabaseUpdateAction
Date Thu, 25 Jul 2002 16:21:17 GMT
Doh! I worked out that DatabaseUpdateAction just took the first array 
item and in IE6 and NS6 this happens to be the same order as they occur 
in the form. I was assuming that this would be the case with all 
clients. Live and learn!

I'll have to find a "proper" solution after next week but this kludge 
will let me make my UI review version deadline for next week ;-)

Thanks

Simon

Christian Haul wrote:

> On 25.Jul.2002 -- 03:31 PM, Simon Price wrote:
> 
>>I've come up with a code-free workaround for the problem.
>>
>>Quick reminder of the problem: HTML checkboxes do not submit a request 
>>value if unchecked and hence DatabaseUpdateAction writes NULL into the 
>>corresponding column in the database. In Cocoon 2.03 there in no way of 
>>overriding this effective "NULL default".
>>
>>What is more typically required is something like: when checked, write 
>>"Y"; when unchecked, write "N". By adding a hidden input field of the 
>>same name as the checkbox input field to your HTML form you can force a 
>>non-NULL default.
>>
> 
> Sorry to disappoint you, but the above does not work reliably: If
> multiple fields with the same name exist, it completely depends on the
> client in what order they are sent.
> 
> So, you get two values and when using the getAttributeValues() method,
> you'll get an array ['Y','N']
> 
> 	Chris.
> 


-- 

-------------------------------------------------------------------
Simon Price
Institute for Learning and Research Technology
University of Bristol
8-10 Berkeley Square
Bristol BS8 1HH
United Kingdom

Direct: +44 (0)7071 226 720
Office: +44 (0)117 928 7193
Fax: +44 (0)117 928 7112
Simon.Price@bristol.ac.uk
http://www.ilrt.bristol.ac.uk


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail:   <cocoon-users-help@xml.apache.org>


Mime
View raw message