Search code examples
javascriptjqueryw2ui

How do I have a list without the -none- option in w2ui?


I want to have a list (select) without the default -none- option using w2ui forms.

How can I remove it so only the items I put in there?


Solution

  • When defining your fields in the form, add showNone: false

    { name: 'field', type: 'list', options: { 
          items: [{ id: 0, txt: 'Adams, John' }, { id: 1, text: 'Adams2, John' }], 
          showNone: false }
     },
    

    In a similar way you can remove - none - for regular fields. See http://w2ui.com/web/docs/form/fields for more information.