I try to use event with type="APPLICATION" in my superbadge step, but can't to get the result even from the simple second component.

I need to get my boat's Id when I press "Search" button. In both alerts I get it. But not in the second component. What is wrong here?


<aura:event type="APPLICATION">
    <aura:attribute name="eventAttribute" type="String"/>


<aura:component controller="BoatSearchFormApex" implements="force:appHostable,flexipage:availableForAllPageTypes" access="global" >
<aura:handler name="init" value="{!this}" action="{!c.doInit}" />
<aura:registerEvent name="formSubmit" type="c.FormSubmit"/>

<aura:attribute name="types" type='String[]' default='All'/>
<aura:attribute name="showNewButton" type="Boolean" default="true"/>

<lightning:layout horizontalAlign="center" verticalAlign="end" class="layoutClass">
    <lightning:select aura:id="types" name="types" variant="label-hidden" label="">
        <option value="allTypesValue">All Types</option>
        <aura:iteration items="{!v.types}" var="type">
            <option value="{!type.Id}">{!type.Name}</option>

    <lightning:button variant="brand" label="Search" onclick="{!c.onFormSubmit}"/>
    <aura:if isTrue="{!v.showNewButton}">
        <lightning:button variant="neutral" label="New" onclick="{!c.newBoat}"/>

Function in controller:

onFormSubmit : function(component, event, helper){
    var typeId = component.find("types").get("v.value");
    var formSubmit = $A.get("e.c:FormSubmit");
    formSubmit.setParams({"eventAttribute" : typeId})
    var test = formSubmit.getParam("eventAttribute");

cmp2 for test:

<aura:component >
<aura:attribute name="Get" type="String"/>
<aura:handler event="c:FormSubmit" action="act"/>
The result is {!v.Get}  


act : function(component, event, helper) {
    var show = event.getParam("eventAttribute");
    component.set("v.Get", show);

1 Answer 1


Your aura:handler tag has action="act", when it should be action="{!c.act}". Don't forget that it has to point to a controller action.

Also, on your declaration, you're using a period instead of a semicolon. Change this <aura:registerEvent name="formSubmit" type="c.FormSubmit"/> to this <aura:registerEvent name="formSubmit" type="c:FormSubmit"/>

  • You're welcome. If this ends up helping, mark the answer as accepted so others can benefit. :) Commented Jan 2, 2019 at 18:13
  • 1
    @user60684 If this answer addressed your problem, please consider accepting it by clicking on the check mark/tick to the left of the answer, turning it green. This marks the question as resolved to your satisfaction, and awards reputation both to you and the person who answered. If you have >= 15 reputation points, you may also upvote the answer if you wish. There is no obligation to do either.
    – Adrian Larson
    Commented Jan 3, 2019 at 17:02

You must log in to answer this question.

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