[Seaside] Disabled Checkboxes

Avi Bryant avi.bryant at gmail.com
Mon Jul 11 12:57:17 CEST 2005

On Jul 5, 2005, at 4:09 PM, Stephane CELET wrote:

> Hi everybody,
> I have a question about disabled checkboxes.
> Is it normal for a disabled checkbox to return false during its  
> callback
> even if it is checked?

Looking at this a little closer, I fear this behavior may be nearly  
inevitable.  The problem is that given the way forms work, there is  
absolutely no difference in what the server receives in these four  

- checkbox is not part of the submit
- checkbox is off
- checkbox is disabled (and on)
- checkbox is disabled (and off)

The way we distinguish between the first two is by generating a  
hidden input just before the checkbox, that will always be part of  
the submit if the checkbox is, and will always send a value.  If we  
see this hidden input's value and the checkbox value, we know the  
checkbox has been set to on (and return true).  If we see just the  
hidden input value, we treat it as if it's been set to off, and  
return false - but of course it could also mean that the checkbox has  
been disabled.  I was at first thinking we could cope with this by  
checking for a disabled checkbox before generating the hidden input,  
but that assumes the checkbox is disabled in the initial generated  
HTML, rather than the (equally common) case of having it be disabled  
by JS on the client side.  I don't think we want to treat those two  
cases differently.

So, I don't have any obvious solutions to propose to this problem.   
Anyone have further ideas?


More information about the Seaside mailing list