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

How to use Lightning Input type=“text”field and set the value to the field.

Asked by Behailu Apr 3, 2021 1.5K views 1 answer
Share

About this question

I am working on a lightning page where I have to use lightning input type= text. And this value I have to pass JS controller for the validation check. But when I am writing code below it is working fine:


({ clickCreateAccount : function(component, event, helper) { var validExpense = true; var accnme = component.find("fstname"); var aname = accnme.get("v.value"); if (($A.util.isEmpty(aname))){ validExpense = false; accnme.set("v.errors", [{message:"Name can't be blank."}]); } else { accnme.set("v.errors", null); } } })

For the same JS controller once I am writing the code on its throwing error:

This page has an error. You might just need to refresh it. Access Check Failed! AttributeSet.set(): 'errors' of component 'markup://lightning:input {18:0} {fstname}' is not visible to 'markup://c:NewAccount_contact {3:0}'. Failing descriptor: {c:NewAccount_contact}
 

What is lightning input and how to use it as my input text field and set the value to the field. Please help me in this!

Your answer

1 Answer

More Salesforce discussions

Learn & Explore

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

Latest Salesforce Blogs

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