1

I am trying to disable button on a standard lightning component in Napili template. The lightning component is called ContactSupportForm and I want to disable the submit button on the load of that. I am unable to use document.getElementsByName , as it always returns nothing for any input.

Can any of you let me know if there is a better way to do it.

1
  • I suspect you'd need to customize the component by putting it in a wrapper and then only display the button when the fields contained valid content or something similar. I've not looked at the component's code to actually say.
    – crmprogdev
    May 7, 2018 at 15:49

1 Answer 1

1

unfortunatelly, this component is not publicly accessible. I have tried wrapping it in a custom component, however, since it is not documented, there is no way of knowing what attributes to reference in it.

You are better off creating a custom lightning component for your Contact Support Form. I would Recommend using the lightning:recordForm which will handle CRUD, FLS and does not need you to invoke an apex class to manage what fields to use in your form.

Basic usage example:

    <lightning:recordEditForm aura:id="recordEditForm"
                            onsubmit="{!c.handleRecordSubmit}"
                            objectApiName="Case">

    <lightning:inputField fieldName="Subject"/>
    <lightning:inputField fieldName="Description" />

<lightning:button aura:id="submit" type="submit" label="Create Case" class="slds-m-top_medium" disabled="true"/>

</lightning:recordEditForm>

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .