custom validation in lightning component -- w3web.net

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

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.

3 thoughts on “How to validate child component from parent component on click button using aura method in lightning component”

Leave a Comment