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
jaishrijaishri 

Can anyone help me to enable button in lwc which was by default disabled


I have two button save as draft and submit in that i gave the condition i can fill the form this week and previous and older week we can't submit or fill the form and i have disabled the button if it is save as draft in olderweek  below code
HTML

<lightning-button label="Save as Draft" variant="success" title="Save as Draft" onclick={handleDraft} class="slds-m-left_x-small" disabled={lockedToEdit}></lightning-button>
                        <lightning-button label="Submit" variant="brand" title="Submit" onclick={handleConfirmation} class="slds-m-left_x-small" disabled={lockedToEdit}></lightning-button>

JS

 submittedFlag = false;
 dayPassedFlag = false;

get lockedToEdit() {
        return this.submittedFlag || this.headView || this.dayPassedFlag;
    }
 //lasttwoweek condition
  if (last2Week.isoWeekday() == 7) {
            last2Week.subtract(1, 'weeks').startOf('isoWeek');
        } else {
            las2Week.subtract(1, 'weeks').startOf('isoWeek');
        }

 if (!this.headView && typeof this.existingFormcontinuation === 'undefined') {
            if (last2Week.isAfter(startDate)) {
                this.spinnerFlag = false;
                this.dispatchEvent(
                    new ShowToastEvent({
                        title: 'Error!!',
                        message: 'You can only fill the form for previous and current week!',
                        variant: 'error'
                    })
                );
                return this.changeDate();
            }
        } else if (!this.headView && typeof this.existingFormcontinuation === 'object') {
            if (last2Week.isAfter(startDate)) {
                this.dayPassedFlag = true;
            } else {
                this.dayPassedFlag = false;
            }
        }else {
            this.dayPassedFlag = false;
        }
now i want to enabled the button if anyone rejected the form in older weeks it is disabled by default because of the condition