Fw-form-control dropdown options is now showing

Hi Team,

I am using fw-form-control dropdown, the dropdown is showing but it is showing no options only even though i have configured the options also.

<fw-form-control
              type="DROPDOWN"
              name="Dropdown"
              required
              label="Sender ID"
              placeholder="Select Dropdown"
              id="Dropdown"
              options={[
                {
                  text: 1,
                  value: "English",
                  position: 1,
                  dependent_ids: {},
                },
                {
                  text: 2,
                  value: "Hindi",
                  position: 2,
                  dependent_ids: {},
                },
                {
                  text: 3,
                  value: "Tamil",
                  position: 3,
                  dependent_ids: {},
                },
              ]}
              disabled={submitting}
            ></fw-form-control>

Hi team,

Kindly share the solution for this ASAP.

Thanks & Regards,
Gopi

The schema in the code snippet you mentioned above looks wrong. The Form Control and the Form “schema” documentation mentions that there is a choices property in fields and not an options property.

Plus, I think the value for the form schema is better set through JavaScript.

Hi @kaustavdm

Could you share me the working code snippet, because i have tried with choices also, but it is now working.

Thanks & Regards,
Gopi

Hi Gopi,

Please try the following:

 <fw-form-control
      type="DROPDOWN"
      name="sel"
      placeholder="First sel"
      required
      label="First sel"
      id="first_sel"
    ></fw-form-control>

Javascript:

document.querySelector("#first_sel").choices = [
  { text: 'one', value: 1 },
  { text: 'two', value: 2 }
]
1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.