custom validation in lightning component -- w3web.net

How to validate child component from parent component on click button using aura method in lightning component | how to validate child component from parent component in lightning component Salesforce

222 views

Hey guys, today in this post we are going to learn about how to validate child component from parent component on click button using aura method in Salesforce lightning component.

Files we used in this post example:-

eventApp.app Lightning Application It is used for call the component to preview on browser.

eventCmp.cmp

Lightning Component It is parent component of "eventValidationCmp.cmp".

eventCmpController.js

Lightning Component Controller It is used for click functionality that gets the value from child component to aura method.
eventValidationCmp.cmp Lightning Component It is a child component of "eventCmp.cmp" and hold aura method attribute with action method.
eventValidationCmpController.js Lightning Component Controller It is used for display validation error messages in lightning component.
eventValidationCmp.css Component Style CSS It is used for create custom stylish form validation error message.

Real time scenarios:- Create a custom and stylish form validation and validate child component from parent component using aura method in lightning component.

Final Output

display validation error messages in lightning component -- w3web.net

Other related post that would you like to learn in lightning component.

 

Step 1:- Create Lightning Application : eventApp.app

From Developer Console >> File >> New >> Lightning Application : eventApp.app

eventApp.app [Component Application File]

Step 2:- Create Lightning Component : eventCmp.cmp

From Developer Console >> File >> New >> Lightning Component

eventCmp.cmp [Lightning Component File]

 

Step 3:- Create Lightning Component : eventCmpController.js

From Developer Console >> File >> New >> Lightning Component >> JavaScript Controller

eventCmpController.j [JavaScript Controller]

 

Step 4:- Create Lightning Component : eventValidationCmp.cmp

From Developer Console >> File >> New >> Lightning Component

eventValidationCmp.cmp [Lightning Component File]

 

Step 5:- Create Lightning Component : eventValidationCmpController.js

From Developer Console >> File >> New >> Lightning Component >> JavaScript Controller

eventValidationCmpController.js [JavaScript Controller]

 

Step 6:- Create Lightning Component : eventValidationCmp.css

From Developer Console >> File >> New >> Lightning Component >> Component Style CSS

eventValidationCmp.css [Style CSS]

custom validation in lightning component -- w3web.net

 

Further post that would you like to learn in lightning component.

 

 

 

FAQ (Frequently Asked Questions)

How do you call a child method from the parent component?

One way to call a child component's function from its parent is with the help of the useRef hook. Here's the gist of it: We pass a Ref to a child component and assign the desired function to the Ref's current key. This then gives you access to that very function in the parent component.

How do you open lightning component from another lightning component?

To navigate from a Lightning component to another, specify the component name using componentDef . This example navigates to a component c:myComponent and sets a value on the contactId attribute.

How do you call one LWC from another LWC?

However, there is a workaround, if you want to navigate the user from one LWC to another LWC, you can embed LWC in an Aura Component and navigate the user from LWC to an Aura Component. Out of the box, LWC framework provides us helper methods to send the user from Lightning Web Component to an Aura Component.

Related Topics | You May Also Like

  • Your reaction of the article ▾
 

Hi, This is Vijay Kumar behind the admin and founder of w3web.net. I am a senior software developer and working in MNC company from more than 8 years. I am great fan of technology, configuration, customization & development. Apart of this, I love to write about Blogging in spare time, Working on Mobile & Web application development, Salesforce lightning, Salesforce LWC and Salesforce Integration development in full time. [Read full bio] | | The Sitemap where you can find all published post on w3web.net

5 thoughts on “How to validate child component from parent component on click button using aura method in lightning component | how to validate child component from parent component in lightning component Salesforce”

Leave a Comment