Wednesday, 15 May 2013

php - Symfony2: Preventing input in a money field is negative -


I want to prevent negative values ​​in a Symfony2 Formbuilder money field, but a minimum (0) or range (min) = 0) Adding emphasis on the annotation of the attribute in the unit does not work: The attributes in the unit are displayed as follows:

  / ** * @ORM \ column (name = "value ", @ Type =" integer ") * @Assert \ Type (type =" integer ", message =" value {{value}} is not a valid {{type}}. "* @asset \ range (min = 0) * @wor int * / no G $ value; / ** * @ORM \ Column (name = "setupFee", type = "integer") * @Assert \ Type (type = "integer", message = "value {{value}} is not valid { {Type}}. ") * @Assert \ Range (min = 0) * @var int * / private $ setupFee;   

The formatting looks like this:

 where ('dedicated circuit contract is NULL');}, ('product' description ' , 'Textera', Array ('label' = & gt; 'producents:', 'atric' => array ('style' = & gt; width: 350px ',' rows' => 4,) ) - gt; add ('value', 'money', array ('label' = 'gt;' nettoparis: ',' divisor '=> gt; 100)) - & gt; ('SetupFee', 'money', array ('label' = & gt; 'Einrichtungsgeb ¼hr:', 'divisor' => 100))   

Any help Try this yaml verification for Symonfy3:

  

app bundle \ unit \ some difference: Properties: Price: - Notebook: ~ - Greater ThanOrequale: Value: 0

NotBlank : ~ fields required.

No comments:

Post a Comment