You need to sign in to do that
Don't have an account?
prasanth kumar
Hi this console.log is not coming. please help.
Hi this console.log is not coming. please help. console.log("inside jaff");. This statement is inside of the action.setcallback.(in the 2nd function of lighning controller) Please help. If i click on the <ui:button label="insert cont" press="{!c.newcontacts}" /> then 3 console logs are coming but the console.log inside the callback method is not coming.
public class eventsexampleapexclass { @AuraEnabled public static string getlightcons(contact con) { system.debug('inside the The error message value is : '); string errormsg ='hello raja'; return errormsg; } } ({ myAction : function(component, event, helper) { // var for judgment on if statement. var ifvalue; var textval = component.find("name").get("v.value"); console.log(textval); var textval2 = component.find("name2").get("v.value"); if(textval == textval2) ifvalue = "true"; console.log('The ifvalue is : '+ ifvalue); component.set("v.ifvalue",ifvalue); }, newcontacts : function(component, event, helper){ var contval = component.get("v.newcontact"); console.log('The con vlaue is ',contval); var action = component.get("c.getlightcons"); action.setParams({ con : contval }); console.log('jaff coming'); console.log("jaff coming22"); action.setCallback(this,function(a){ console.log("inside jaff"); }); console.log("jaff coming22123"); } }) <aura:component controller="eventsexampleapexclass"> <!-- <aura:handler name="init" value="{!this}" action="{!c.myAction}" /> --> <aura:attribute name="ifvalue" type="String" /> // checking the two inputtext values are same or not. <ui:inputtext label="your name" aura:id="name" /> <ui:inputtext label="you name again" aura:id="name2" change="{!c.myAction}" /> .....The value of ifvalue is : {!v.ifvalue} .... <br/><br/> <aura:if isTrue="{!v.ifvalue}"> True <aura:set attribute="else"> False </aura:set> </aura:if> <br/><br/> <h2>The New contact details</h2> <aura:attribute name="newcontact" type="contact" default="{ 'sobjectType': 'Contact' }"/> <aura:attribute name="errormeg" type="string" /> <h2 style="color:red;">{!errormeg}</h2> <ui:inputText aura:id="contactName" value="{!v.newcontact.Name}" label="Name"/> <ui:inputPhone value="{!v.newcontact.Phone}" aura:id="contactPhone" label="Phone"/> <ui:inputText value="{!v.newcontact.Department}" aura:id="contactde" label="Department"/> <ui:inputDate value="{!v.newcontact.Birthdate}" aura:id="contactbd" label="D.O.B" displayDatePicker="true"/> <ui:inputText value="{!v.newcontact.Level__c}" aura:id="contactll" label="Level"/> <br/><br/> <ui:button label="insert cont" press="{!c.newcontacts}" /> </aura:component>
use $A.enqueueAction(action); in your contoller
({
myAction : function(component, event, helper) {
// var for judgment on if statement.
var ifvalue;
var textval = component.find("name").get("v.value");
console.log(textval);
var textval2 = component.find("name2").get("v.value");
if(textval == textval2)
ifvalue = "true";
console.log('The ifvalue is : '+ ifvalue);
component.set("v.ifvalue",ifvalue);
},
newcontacts : function(component, event, helper){
var contval = component.get("v.newcontact");
console.log('The con vlaue is ',contval);
var action = component.get("c.getlightcons");
action.setParams({
con : contval
});
console.log('jaff coming');
console.log("jaff coming22");
action.setCallback(this,function(a){
var state = a.getState();
alert(state);
console.log("inside jaff");
});
console.log("jaff coming22123");
$A.enqueueAction(action);
}
})
thanks
Mark it best answer if it helps you