Skip to main content
I have to display fields on condition-based

if type equals text then I have to display text fields

  <template for:each={questions} for:item="qs">

            <div key={qs}>

        <template if:true={qs.type='multiselect'}>

                           

            <lightning-dual-listbox name="duallist" label="multiselect" source-label="Available" selected-label="Selected"

            options={options}

            onchange={handleMultiselectChange}></lightning-dual-listbox>

        </template>

        <template if:true={qs.type='dropdown'}>           

            <lightning-combobox name="combobox" label="dropdown" value={value} placeholder="Select" options={options}

            onchange={handleDropdownChange} ></lightning-combobox>

        </template>   

            <template if:true={qs.type='checkbox'}>                

                <lightning-input type="checkbox" label="checkbox" name="checkbox"></lightning-input>

              </template>

              

              <template if:true={qs.type='text'}>

                <lightning-input type="text" label="text" name="text"></lightning-input>

              </template>

            </div>

            </template>>

Please help me on this
5 réponses
  1. 11 mai 2020, 16:50
    The multiselect boolean should be on record level instead of on page level.

    i.e.

    <template if:true={qs.multiselect}>
0/9000