0

I read all question about this error and I cannot find the problem in my code. Here it is:

HTML:

<!-- ComboBox Main Guilds-->
                    <lightning-vertical-navigation>
                        <lightning-vertical-navigation-section>
                            <lightning-combobox name={guildCb} label={guildCb} placeholder={guildPlaceCb} class="validgGuild"
                                options={optionsGuildToShow} onchange={handleGuildOnChange} value={idGuild} required>
                            </lightning-combobox>
                        </lightning-vertical-navigation-section>
                    </lightning-vertical-navigation>

                    <!-- ComboBox to Other Guilds -->
                    <lightning-vertical-navigation if:true={showOtherGuilds}>
                        <lightning-vertical-navigation-section>
                            <lightning-combobox name="Others" label="Others" placeholder={guildPlaceCb} class="validOtherGuild"
                                options={otherOptionsToShow} onchange={handleOtherGuildOnChange} value={idOtherGuild} required>
                            </lightning-combobox>
                        </lightning-vertical-navigation-section>
                    </lightning-vertical-navigation>

JS:

handleGuildOnChange(event) {
         // Get key and clean ComboBox from work type.
         this.idGuild = event.detail.value;
         console.log('TEST IDGUILD->' + this.idGuild);
         if(this.idGuild === 'Others') {
             this.showOtherGuilds = true;
         } else {
            this.showOtherGuilds = false; 
         }
         this.optionsWorkType = [];
         this.idWorkType = null;
 
         this.setValidity();
 
         const workTypes = this.mapWorkTypes.get(this.idGuild);
 
         if (workTypes.length === 0) {
             this.noWorkTypeError = true;
         } else {
             this.noWorkTypeError = false;
             for (const wrapper of workTypes) {
                 const option = {
                     label: wrapper.test,
                     value: wrapper.test
                 };
                this.optionsWorkType = [...this.optionsWorkType, option];
             }
 
             // Enable ComboBox from work types.
             this.disableWorkTypes = false;
 
     }
   }

     handleOtherGuildOnChange(event) {
        // Get key and clean ComboBox from work type.
        this.idOtherGuild = event.detail.value;
        this.optionsWorkType = [];
        this.idWorkType = null;

        this.setOtherValidity();

        const workTypes = this.mapWorkTypes.get(this.idOtherGuild);

        if (workTypes.length === 0) {
            this.noWorkTypeError = true;
        } else {
            this.noWorkTypeError = false;
            for (const wrapper of workTypes) {
                const option = {
                    label: wrapper.test,
                    value: wrapper.test2
                };
               this.optionsWorkType = [...this.optionsWorkType, option];
            }

            this.disableWorkTypes = false;
    }
  }

This is my main code about this part. I could paste more code if you need it for solving problem. My code works okay, and runs information and data; but the problem is, when I select the picklist value, I get the error [NoErrorObjectAvailable] Script error prompt. Then, I click OK and I can continue my development.

Error happens when I select the option 'Other' in my picklist ComboBox Main Guilds.

Any idea?

2
  • optionsWorkType is always an empty array? if not, when and where are you adding values to it? what does that array look like?
    – glls
    Commented Jan 17, 2022 at 14:30
  • At the moment I select the picklist value option, It fills the array with desired data. It works okay, I mean, as I wrote, development works perfectly. Problem is that an error prompt is shown when I select 'Other' picklist value.
    – CPS
    Commented Jan 19, 2022 at 11:11

0

You must log in to answer this question.