3

I have a component that's basically a contact form. There are some text fields and a submit button.

There is a check if the form has already been submitted in the past.

Upon click of the submit button, I do want the component to reload immediately, so it can show that it has been submitted. This is both to provide feedback to the user that his action was successful and also to prevent the form being submitted more than once.

I had a look at $A.get("e.force:refreshView"), but it seems this does not work in lightning. Using a helper method with window.location.reload() would be my last resort, as I don't want the whole page to refresh, just the component in the sidebar.

Any ideas?

4

Your custom components won't magically refresh even when you fire refreshViewEvent.

In all your custom components you have to implement the handler for refreshView and then call the initilizeMethod to refresh.

<aura:handler event="force:refreshView" action="{!c.doInitInCustomComponent}"/>


doInitInCustomComponent: function(cmp, evt, hlp){
    // your refresh logic here
},

src: Listening for the record create event

src: https://salesforce.stackexchange.com/a/217713/19118

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.