function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Carolina W 2Carolina W 2 

How can I disable a LWC button only if the Omniscript fields are empty?


In Step 1 on an Omniscript, I have two text elements: "neighborhood" and "city".
There is also the "Search" button made in LWC. I need it to be disabled only if the fields "neighborhood" OR "city" are empty, but I'm not getting it... Can anyone help me? Here's what I tried to do initially:

Omniscript
User-added image

Preview
User-added image

searchButtonLWC.html
<template><div><lightning-button
            variant="destructive" 
            label="Search"
            onclick={handleClick}
            disabled={disableButton}
            class="slds-m-vertical_medium"></lightning-button></div></template>

​searchButtonLWC.js
import { LightningElement, api} from 'lwc';
import { OmniscriptActionCommonUtil } from "vlocity_cmt/omniscriptActionUtils";
import { getNamespaceDotNotation } from "vlocity_cmt/omniscriptInternalUtils";
import { OmniscriptBaseMixin } from 'vlocity_cmt/omniscriptBaseMixin';
 
export default class searchButtonLWC extends OmniscriptBaseMixin(LightningElement) {
 
    @api neighborhood;
    @api city;
   
    _ns = getNamespaceDotNotation();
    _actionUtilClass;
 
    connectedCallback() {
        this._actionUtil = new OmniscriptActionCommonUtil();
    }
 
    handleClick() {
    }   
 
    get requiredFieldsFilled(){
        return (this.neighborhood && this.city);
    }
 
    disableButton(){
        return !(this.requiredFieldsFilled());
    }
 
}


 
Best Answer chosen by Carolina W 2
Carolina W 2Carolina W 2
I changed
 
get requiredFieldsFilled(){
        return (this.neighborhood && this.city);
    }
 
    disableButton(){
        return !(this.requiredFieldsFilled());
    }
To
 
requiredFieldsFilled(){
        return (this.neighborhood && this.city);
    }
 
    get disableButton(){
        return !(this.requiredFieldsFilled());
    }