[FLOW3-general] fluid form.checkbox boolean

Heiko Kromm | Paints h.kromm at paints.de
Tue Apr 26 16:50:24 CEST 2011


Hi Bastian, 

I'm using FLOW3 Version 1.0.0.-alpha14. 
I've changed my code to match the CGL, but I get this error again: 
#1244465559: Expected property of type boolean, but got string 
If I cast the value in the setter it will be ok: 
public function setVisible($visible) { 
$this->visible = (bool) $visible; 
} 

Regards 
Heiko 


Von: "Bastian Waidelich" <bastian at typo3.org> 
An: flow3-general at lists.typo3.org 
Gesendet: Mittwoch, 20. April 2011 16:27:56 
Betreff: Re: [FLOW3-general] fluid form.checkbox boolean 

Heiko Kromm | Paints wrote: 

Hi Heiko, 

> In my Domain Model I have a property isVisible, which is boolean. 
> 
> /** 
> * Is visible 
> * 
> * @var boolean 
> */ 
> protected $isVisible = true; 

If you want to follow our CGL, this would be: 

/** 
* @var boolean 
**/ 
protected $visible = TRUE; 

/** 
* @return boolean 
**/ 
public function isVisible() { 
return $this->visible; 
} 

/** 
* @param boolean $visible 
**/ 
public function setVisible($visible) { 
$this->visible = $visible; 
} 


> Now I'm building an input form with fluid and have the field: 
> <f:form.checkbox property="isVisible" id="isVisible" value="1" /> 

If you refer to a getter from within Fluid, you omit the "get" or "is": 
<f:form.checkbox property="visible" id="isVisible" value="1" /> 


> When I try to save my new element I will get an error-message 
> that isVisible is a string and that a boolean value is expected. 

Which version of FLOW3 are you using? With the current version, this 
should work without changes. 

Best, 
Bastian 
_______________________________________________ 
FLOW3-general mailing list 
FLOW3-general at lists.typo3.org 
http://lists.typo3.org/cgi-bin/mailman/listinfo/flow3-general 


More information about the FLOW3-general mailing list