Ask a Question
Ask Question Login
Corporate Training
  1. Community
  2. AWS
  3. Question
AWS

Lightning Component: Cannot read property 'get' of undefined

Asked by Anisha Dalal Apr 22, 2021 535 views 1 answer
Share

About this question

I've read through the different posts regarding this error, and for the life of me I cannot figure out why it's not working right.... I would really appreciate some help. I've checked to make sure cases match with naming things, and tried to follow every guide I could find and post regarding the same error. It's an exercise for collecting credit card information, after first authenticating with an external system like Zuora. When it loads, it returns the current payment information, and this part is working right. I get the following error though when I try to click the !c.submitButton.

Uncaught Action failed: c:PO_UpdateZuoraPayment$controller$submitButton [Cannot read property 'get' of undefined Below is my code. cmp JavaScript controller

({ //this comment added for this post. This doInit is working fine as far as I can tell. doInit : function (component, event, helper) { console.log('initenn'); var action = component.get("c.getThisAccount"); action.setParams({ "recordId" : component.get("v.recordId") }); action.setCallback(this, function(response){ var data = JSON.parse(response.getReturnValue()); console.log('json parse test :: '); console.dir(data); if(data != null){ //console.log('data returned :: ' + data); //component.set("v.account", data); component.set("v.cardHolderName", data.cardHolderName); component.set("v.zuoraAccountId", data.zAccountId); component.set("v.cardNumber", data.cardNumber); component.set("v.cardExpMonth", data.cardMonth); component.set("v.cardExpYear", data.cardYear); } }); $A.enqueueAction(action); }, submitButton : function(cmp, evt){ //the below is what throws my error var selected = evt.getSource().get("v.label"); var resultCmp = cmp.find("cardForm"); var final = resultCmp.get("v.value"); //tried this as well, same error //var nameGrab = component.find("cardform"); //var nameGrab2 = nameGrab.get("v.value"); //console.log(nameGrab2); } })

Your answer

1 Answer

More AWS discussions

Learn & Explore

Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.

Latest AWS Blogs

Guides, tips and career advice on AWS from JanBask experts.