1

I have a plugin with record and model both setting required to true for a frontend form entry:

'fieldName' =>  array(AttributeType::Name, 'required' => true),

However it is still validating the select option even when there is no value so:

<select id="fieldName" name="fieldName">
    <option>--select one--</option>

or

<option value=''>--select one--</option>

Still validates as true.

How can I get around this?

1

You could try setting a minimum length:

'fieldName' =>  array(AttributeType::Name, 'minLength' => 1, 'required' => true),
  • cheers @carlcs that worked – Lettie May 22 '15 at 12:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.