Gabor
Gabor

Reputation: 1489

How to select the forst item of w2ui list field

I have a w2ui form with this list field:

...
{ field: 'field_module', type: 'list', required: true,
  html: { caption: 'Program', attr: 'size="14"', span: 3 }},
...

Once I have loaded the items via ajax (that works fine) I would like to preselect the first item of that list. How to achieve this?

Upvotes: 0

Views: 409

Answers (1)

Gabor
Gabor

Reputation: 1489

I've found the answer. Quite easy, even if I couldn't find out how to select the first item numerically

form.record.field_module = {id: '--ALL--', text: '--ALL--'};

Upvotes: 0

Related Questions