• Alvin Bernard 1
  • NEWBIE
  • 0 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 3
    Replies
Hey Everyone, 

I am having trouble displaying the Toast message, in a simple Lightning component, Following os the code.

Cmp
<aura:component implements="flexipage:availableForAllPageTypes" access="global">	

    <aura:attribute name="result" type="String" />
    
    <div aura:id="input" class="slds-box small" >
        <div aura:id="panelList">
            <header class="slds-m-bottom--small">
                <div class="slds-media slds-media--center slds-m-bottom--small">
                    <div class="slds-media__figure">
                        <lightning:icon iconName="utility:answer" />
                    </div>
                    <div class="slds-media__body">
                        <h2 class="slds-text-heading--small "> Text Analyzer </h2>
                    </div>
                </div>
                <div class="slds-form-element">
                    <label class="slds-form-element__label slds-assistive-text" for="searchBox">Search</label>
                    <div class="slds-form-element__control">
                        <ui:inputText aura:id="Text2Analyze" class="slds-input" placeholder="Enter any text..." change="{!c.updateSearch}"/>
                    </div>
                </div>
            </header>
        </div>
    </div>
    
</aura:component>

Controller.js
({
	updateSearch : function(component, event, helper) {
		var inputText = escape(component.find("Text2Analyze").get("v.value"));
        console.log(inputText.length);
        helper.toastThis(inputText.length, 'Input text Length')
	}
})

helper.js
({
	toastThis : function(message, title) {
        var toastEvent = $A.get("e.force:showToast");
        toastEvent.setParams({
            "title": title || "Error:",
            "message": message,
            "type": "error",
            "mode": "sticky"
        });
        toastEvent.fire();
    }
})

demo App
<aura:application extends="force:slds">
    <c:toastComponent />
</aura:application>

And This is the Error I am getting, when i tired to run it
Action failed: c:toastcomponent$controller$updateSearch [Cannot read property 'setParams' of undefined]
Failing descriptor: {c:toastcomponent$controller$updateSearch}


Please point out the mistakes i made. 

Best,
Nithesh
can you please tell me what is the use of action region? and why & when we're using it?
any sample example please.
The Sharing Rules like for an Oppy, in the GUI, have a "TYPE" attribute. For example "Roles and Subordinates", "Role", "Group" or single user. Is there way I can use the API to realize that this Type for the Rule sharing entity is in fact a "Roles and Subordinates" ?