[TYPO3-mvc] Render model validation rules in fluid form fields

Steffen Müller typo3 at t3node.com
Tue Jan 31 20:44:43 CET 2012


Hi.

On 31.01.2012 14:50 Claus Due wrote:
> 
> The fed:form ViewHelper already does this per-property or per-object validation using AJAX. I am considering turning this into a Widget which can be used as a container for form fields, making them validate and save using AJAX.
> 
> I suppose you can use the fed:form ViewHelper to get validation going - but it doesn't state the rules when rendering the form field and there is currently no reporting of the particular error which occurred, just that an error occurred.
> 

Per-property validation using ajax can be a performance hog. So I'd
prefer client side validation using rules from element attributes.

Something like:

Model:

class Tx_Foo_Domain_Model_Bar {
/**
* @var string
* @validate RegularExpression(regularExpression=/\d{5}/)*
*/
protected $zipcode;

HTML5:
<input name="zipcode" type="text" pattern="\d{5}" >

-- 
cheers,
Steffen

TYPO3 Blog: http://www.t3node.com/
Twitter: @t3node - http://twitter.com/t3node


More information about the TYPO3-project-typo3v4mvc mailing list