{"id":3187,"date":"2020-06-14T04:27:06","date_gmt":"2020-06-14T09:57:06","guid":{"rendered":"https:\/\/www.emizentech.com\/blog\/?p=3187"},"modified":"2022-01-21T11:42:30","modified_gmt":"2022-01-21T11:42:30","slug":"handling-form-values-on-event-in-lwc","status":"publish","type":"post","link":"https:\/\/multisitelocal.ezxdemo.com\/blog\/handling-form-values-on-event-in-lwc.html","title":{"rendered":"How To Handle Form Values On Event In LWC In Salesforce"},"content":{"rendered":"<p>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.<\/p>\n<p>Basically, all kinds of form include either input-text, input-number, select box, checkbox, and so on. Let\u2019s have an example of these and how we can get values from these.<\/p>\n<p><img fetchpriority=\"high\" decoding=\"async\" class=\"aligncenter wp-image-3189 size-full\" src=\"\/blog\/wp-content\/uploads\/sites\/2\/2020\/06\/code-1.jpg\" alt=\"Code LWC\" width=\"866\" height=\"629\" \/><img decoding=\"async\" class=\"aligncenter wp-image-3190 size-full\" src=\"\/blog\/wp-content\/uploads\/sites\/2\/2020\/06\/code-2.jpg\" alt=\"Code LWC Salesforce\" width=\"863\" height=\"575\" \/><img decoding=\"async\" class=\"aligncenter wp-image-3191 size-full\" src=\"\/blog\/wp-content\/uploads\/sites\/2\/2020\/06\/code-3.jpg\" alt=\"Handling Form LWC\" width=\"863\" height=\"632\" \/><\/p>\n<div class=\"center-imgs\"><a href=\"https:\/\/multisitelocal.ezxdemo.com\/contact-us.html?utm_source=blog&amp;utm_medium=banner&amp;utm_campaign=emizen_blog\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-2389 size-full\" src=\"\/blog\/wp-content\/uploads\/sites\/2\/2020\/05\/hire-salesforce-developers-1.png\" alt=\"hire salesforce developers\" width=\"1000\" height=\"200\" \/><\/a><\/div>\n<h2>In JS file:<\/h2>\n<\/div>\n<div class=\"blog-text casestudy-content text-justify\">\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-3198 size-full\" src=\"\/blog\/wp-content\/uploads\/sites\/2\/2020\/06\/js-code-1.jpg\" alt=\"handling form values\" width=\"712\" height=\"627\" \/><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-3199 size-full\" src=\"\/blog\/wp-content\/uploads\/sites\/2\/2020\/06\/js-code-2.jpg\" alt=\"handling form values js code\" width=\"576\" height=\"629\" \/><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-3200 size-full\" src=\"\/blog\/wp-content\/uploads\/sites\/2\/2020\/06\/js-code-3.jpg\" alt=\"js code salesforce\" width=\"756\" height=\"293\" \/>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.<\/p>\n<p>For any other assistance with your salesforce projects consult our experienced <a href=\"https:\/\/multisitelocal.ezxdemo.com\/salesforce.html\">salesforce developers<\/a> and take benefit from our <a href=\"https:\/\/multisitelocal.ezxdemo.com\/salesforce-consulting.html\">salesforce consulting services<\/a>.<\/p>\n<h4>Also Read: <a href=\"https:\/\/multisitelocal.ezxdemo.com\/blog\/database-stateful-in-batch-apex.html\">How To Use Database.Stateful In Batch Apex In Salesforce<\/a> and <a href=\"https:\/\/multisitelocal.ezxdemo.com\/blog\/create-custom-report-types-salesforce.html\">How To Create A Custom Report Type In Salesforce<\/a><\/h4>\n","protected":false},"excerpt":{"rendered":"<p>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\u2019s have an example of these and how we can<\/p>\n","protected":false},"author":39,"featured_media":3235,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"MSN_Categories":"Uncategorized","MSN_Publish_Option":false,"MSN_Is_Local_News":false,"MSN_Is_AIAC_Included":"Empty","MSN_Location":"[]","MSN_Add_Feature_Img_On_Top_Of_Post":false,"MSN_Has_Custom_Author":false,"MSN_Custom_Author":"","MSN_Has_Custom_Canonical_Url":false,"MSN_Custom_Canonical_Url":"","_lmt_disableupdate":"","_lmt_disable":"","footnotes":""},"categories":[87],"tags":[],"class_list":{"0":"post-3187","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-salesforce-development"},"modified_by":"emizentech","featured_image_src":"https:\/\/multisitelocal.ezxdemo.com\/blog\/wp-content\/uploads\/sites\/2\/2020\/06\/How-To-Handle-Form-Values-On-Event-In-Salesforce-1.jpg","featured_image_src_square":"https:\/\/multisitelocal.ezxdemo.com\/blog\/wp-content\/uploads\/sites\/2\/2020\/06\/How-To-Handle-Form-Values-On-Event-In-Salesforce-1.jpg","author_info":{"display_name":"Virendra Sharma","author_link":"https:\/\/multisitelocal.ezxdemo.com\/blog\/author\/salesforce"},"_links":{"self":[{"href":"https:\/\/multisitelocal.ezxdemo.com\/blog\/wp-json\/wp\/v2\/posts\/3187","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/multisitelocal.ezxdemo.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/multisitelocal.ezxdemo.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/multisitelocal.ezxdemo.com\/blog\/wp-json\/wp\/v2\/users\/39"}],"replies":[{"embeddable":true,"href":"https:\/\/multisitelocal.ezxdemo.com\/blog\/wp-json\/wp\/v2\/comments?post=3187"}],"version-history":[{"count":0,"href":"https:\/\/multisitelocal.ezxdemo.com\/blog\/wp-json\/wp\/v2\/posts\/3187\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/multisitelocal.ezxdemo.com\/blog\/wp-json\/wp\/v2\/media\/3235"}],"wp:attachment":[{"href":"https:\/\/multisitelocal.ezxdemo.com\/blog\/wp-json\/wp\/v2\/media?parent=3187"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/multisitelocal.ezxdemo.com\/blog\/wp-json\/wp\/v2\/categories?post=3187"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/multisitelocal.ezxdemo.com\/blog\/wp-json\/wp\/v2\/tags?post=3187"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}