Answers.Body: <p>Your best option would be to create a custom field type. That's quite a bit of work, though.</p>
  
  <p>Failing that, you could add an extra "Other" option to the select field, and create a separate text field to hold the "free form" option.</p>
  
  <h3>Caveats</h3>
  
  <p>Craft isn't able to automatically validate the association between two fields. In other words, there's no such thing as "if the user selects the 'other' option, then she must also complete the 'Other' field".</p>
  
  <p>If this is a must-have, you could implement some front-end validation, by injecting custom JavaScript into the Control Panel. Once again, a plugin is the best way to go here, but you may also be able to piggy-back on something like <a href="https://github.com/lindseydiloreto/craft-cpjs/blob/master/README.md" rel="nofollow noreferrer">craft-cpjs</a>, by Lindsey Diloreto.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-04-21T16:19:29.210Z
Answers.LastActivityDate: 2017-04-21T16:19:29.210Z
Answers.UserDisplayName: Stephen Lewis
Body: <p>Well, I need to add options to a select field with Javascript. I do that with <code>$(...).append(...)</code>, the problem is that I get a "Invalid" message. I think it's because the new option's value is not in the available options.</p>
  
  <p>My question is then: Can I add a wildcard to the options? or bypass the validation for this field?</p>
  
  <p>Any better idea?</p>
  
  <p>Thanks!</p>
  
Tags: <plugin-development>
Title: Add options to multi-select with Javascript
ThreadText: # Add options to multi-select with Javascript
  
  (Asked by: username_0 on 2017-04-21)
  
  Well, I need to add options to a select field with Javascript. I do that with `$(...).append(...)`, the problem is that I get a "Invalid" message. I think it's because the new option's value is not in the available options.
  
  My question is then: Can I add a wildcard to the options? or bypass the validation for this field?
  
  Any better idea?
  
  Thanks!
  
  **Tags:** plugin-development
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2017-04-21. Score: 1
  
  Your best option would be to create a custom field type. That's quite a bit of work, though.
  
  Failing that, you could add an extra "Other" option to the select field, and create a separate text field to hold the "free form" option.
  
  ### Caveats
  
  Craft isn't able to automatically validate the association between two fields. In other words, there's no such thing as "if the user selects the 'other' option, then she must also complete the 'Other' field".
  
  If this is a must-have, you could implement some front-end validation, by injecting custom JavaScript into the Control Panel. Once again, a plugin is the best way to go here, but you may also be able to piggy-back on something like [craft-cpjs](https://github.com/lindseydiloreto/craft-cpjs/blob/master/README.md), by Lindsey Diloreto.
  
  
  ---
  
  