While web component development handling form values on event trigger is the basic thing we have to do. In this blog, we will learn how to handle values on event.
Basically, all kinds of form include either input-text, input-number, select box, checkbox, and so on. Let’s have an example of these and how we can get values from these.
In JS file:
In this example, we have seen the ways to use existing input types in our component. We recommend using this because this type has inbuilt HTML 5 validation. Like if someone enters an invalid format of URL or email it will show the error. Please check by entering some wrong values. In JS file we have used event which is a basic JavaScript object and event target contains the element that triggered the event. So we used event.target.value to fetch the value of that element and similarly to check the type of element. I hope this blog will help to design your UI in an easier manner.
For any other assistance with your salesforce projects consult our experienced salesforce developers and take benefit from our salesforce consulting services.