It concernes a text field, with an optional content. So empty is allowed.
When you add a value to the field, everything works fine, but as soon as you empty the field (removing the content) this results in a validation error, and of course that is not what I want, since empty must be accepted too.
The extension functionality is not affected. If you ignore the errormessage, everything works as it should. Also, when you refresh the admin page, the field comes back empty, without content and without error.
The code block for the field, including the validation line is:
- Code: Select all
$form->add( array(
'type' => 'text',
'size' => 50,
'name' => "url".$i,
'label' => "Link url ".$i,
'validation' => 'ifany|string|maxlen=50'
));
(The $i variables in name and label are there because the field is part of a for loop)
It's my first extension, so probably I'm missing something, but I have no clue what.