[Tickets #11308] Horde_Form_Type_boolean does not accept direct true or false values

bugs at horde.org bugs at horde.org
Mon Jul 23 02:58:05 UTC 2012


DO NOT REPLY TO THIS MESSAGE. THIS EMAIL ADDRESS IS NOT MONITORED.

Ticket URL: http://bugs.horde.org/ticket/11308
------------------------------------------------------------------------------
  Ticket             | 11308
  Created By         | lfbm.andamentos at gmail.com
  Summary            | Horde_Form_Type_boolean does not accept direct true or
                     | false values
  Queue              | Horde Framework Packages
  Version            | Git master
  Type               | Enhancement
  State              | New
  Priority           | 1. Low
  Milestone          |
  Patch              | 1
  Owners             |
------------------------------------------------------------------------------


lfbm.andamentos at gmail.com (2012-07-23 02:58) wrote:

getInfo method of Horde_Form_Type_boolean will only properly work with  
'on' as variable value. So it will fail if you wish to work with  
hidden variables that are directly set as (bool)true or (bool)false in  
your form.

For example, if you create a hidden variable of the type 'boolean' in  
your form, you can´t manually assign to it a value of (bool)true,  
because the getInfo method, once called, will say the variable is  
false (since it´s not equal to 'on' in the getInfo method).

The consequence is this type will only work as expected for visible  
variables in the form. For hidden variables, you should manually  
assign the string 'on' when you want it to evaluate as true, which is  
unintuitive, since it is a boolean type, so you should be able to  
simply set the hidden variable to 'true' of 'false', instead of 'on'  
or not setting the variable.

So I guess the getInfo method of this type should first check if the  
variable value is already a boolean and then return it. In case it  
isn´t a boolean, then it should check if it´s equal to 'on' and  
evaluate properly, as it already does.

Attached is my suggestion.



lfbm.andamentos at gmail.com (2012-07-23 02:58) uploaded:  
0001-Allow-Horde_Form_Type_boolean-to-accept-hidden-true-.patch

http://bugs.horde.org/h/services/download/?module=whups&actionID=download_file&file=0001-Allow-Horde_Form_Type_boolean-to-accept-hidden-true-.patch&ticket=11308&fn=%2F0001-Allow-Horde_Form_Type_boolean-to-accept-hidden-true-.patch





More information about the bugs mailing list