asprin
Active member
In my custom entity, I have a field such as:
The form is something like this:
Of course, there are other fields as well, but if nothing in selected for "Foo" and submit button is pressed, the form submits successfully and in the database, the value gets set as "0".
Controller action is like this:
Any way to validate empty UINT values without having to write code in the controller?
PHP:
'foo' => ['type' => self::UINT, 'required' => true]
The form is something like this:
HTML:
<xf:selectrow label="Foo" value="{$entity.foo}" name="foo">
<xf:option value="">Select One</xf:option>
<option value="1">Abc</option>
<option value="2">Ghi</option>
<option value="3">Def</option>
</xf:selectrow>
Of course, there are other fields as well, but if nothing in selected for "Foo" and submit button is pressed, the form submits successfully and in the database, the value gets set as "0".
Controller action is like this:
PHP:
protected function formSaveProcess(\Asprin\FB\Entity\Bar $bar)
{
$data = array();
$data['first'] = 'str';
$data['last'] = 'str';
$data['foo'] = 'int';
$input = $this->filter($data);
$form = $this->formAction();
$form->basicEntitySave($bar, $input);
return $form;
}
Any way to validate empty UINT values without having to write code in the controller?