Skip to content

Nylo Forms not initialising picker field data #271

@Im-PJ

Description

@Im-PJ

Im using Nylo Forms and trying to initialise data in form class, referring docs-https://nylo.dev/docs/6.x/forms#managing-form-data

However I have noticed that picker fields which uses List are not getting initialised from init method. If I use form.setFieldOptions it is getting initialised. Am I doing something wrong or docs are not updated or this is bug.

  @override
  get init => () async {
    /// Initial data for the form
      unitData = await api<CommonApiService>((request) => request.fetchDropDowns(nType: 'DDL_BookingUnit'));
    return {
      'unit': unitData.map((e) => e.ddlDesc ?? "").toList() 
 // 'unit': ['Unit1','Unit2']  // this also doesnt work
    };

  };

@override
  fields()  {
     return  [
      Field.picker("unit",
          options: [],
          label: "Unit",
           validate: FormValidator.notEmpty())
....

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions