Answers.Body: <p>You could try setting a minimum length:</p>
  
  <pre><code>'fieldName' =&gt;  array(AttributeType::Name, 'minLength' =&gt; 1, 'required' =&gt; true),
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-05-22T12:59:28.623Z
Answers.Text: cheers @carlcs that worked
Answers.UserDisplayName: Lettie
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-05-22T12:29:59.727Z
Answers.LastActivityDate: 2015-05-22T12:29:59.727Z
Answers.UserDisplayName: carlcs
Body: <p>I have a plugin with record and model both setting required to true for a frontend form entry:</p>
  
  <pre><code>'fieldName' =&gt;  array(AttributeType::Name, 'required' =&gt; true),
  </code></pre>
  
  <p>However it is still validating the select option even when there is no value so:</p>
  
  <pre><code>&lt;select id="fieldName" name="fieldName"&gt;
      &lt;option&gt;--select one--&lt;/option&gt;
  </code></pre>
  
  <p>or</p>
  
  <pre><code>&lt;option value=''&gt;--select one--&lt;/option&gt;
  </code></pre>
  
  <p>Still validates as true.</p>
  
  <p>How can I get around this?</p>
  
Tags: <form><validation>
Title: Select statement validating as true when no value selected?
ThreadText: # Select statement validating as true when no value selected?
  
  (Asked by: username_0 on 2015-05-22)
  
  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?
  
  **Tags:** form, validation
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-05-22. Score: 1 | Accepted answer
  
  You could try setting a minimum length:
  
  ```
  'fieldName' =>  array(AttributeType::Name, 'minLength' => 1, 'required' => true),
  
  ```
  
  > **Comments:**
  > **username_0**: cheers @username_1 that worked  
  
  ---
  
  