How to get/set checkbox value in lwc component and display the selected value using of “lightning-checkbox-group” property in Lightning Web Component (LWC) Salesforce | how to get selected checkbox value in lwc

Vijayk
3 min readAug 21, 2021

--

Hey guys, today in this post we are going to learn about How to get checkbox value in lwc component and display the selected value using of “lightning-checkbox-group” property in Lightning Web Component (LWC) Salesforce.

A lightning-checkbox-group component represents a checkbox group that enables selection of single or multiple options.

If the required attribute is set, at least one checkbox must be selected. When a user interacts with the checkbox group and doesn’t make a selection, an error message is displayed. You can provide a custom error message using the message-when-value-missing attribute.

If the disabled attribute is set, checkbox selections can’t be changed.

This example creates a checkbox group with three options and option1 is selected by default. To read more about lightning-checkbox-group, click

Files we used to get selected checkbox value in LWC

lwcCheckboxValue.html

LWc HTML File

Template HTML file to get selected checkbox value in Salesforce Lightning Web Component (LWC)

lwcCheckboxValue.js

LWC JavaScript File

It’s hold a javascript on Handle handleChange function to get the value of selected checkbox in lwc.

lwcCheckboxValue.js-meta.xml

XML Meta File

It is used to where this lightning web component file you want to display as lightning__AppPage, lightning__RecordPage, lightning__HomePage.

Final Output → To get source code lived demo, Click Here..

Other related post that would you like to learn in LWC

Create Lightning Web Component HTML

Step 1:- Create Lightning Web Component HTML ➡ lwcCheckboxValue.html

SFDX:Lightning Web Component ➡ New ➡ lwcCheckboxValue.html

lwcCheckboxValue.html [Lightning Web Component HTML]

Create Lightning Web Component Javascript

Step 2:- Create Lightning Web Component Javascript ➡ lwcCheckboxValue.js

SFDX:Lightning Web Component ➡ New ➡ lwcCheckboxValue.js

lwcCheckboxValue.js [LWC JavaScript File]

Create Lightning Web Component Meta XML

Step 3:- Create Lightning Web Component Meta XML ➡ lwcCheckboxValue.js-meta.xml

SFDX:Lightning Web Component ➡ New >> lwcCheckboxValue.js-meta.xml

lwcCheckboxValue.js-meta.xml [LWC Meta Data XML]

Lightning Web Component Meta XML

Further post that would you like to learn in LWC Flyout is a free, simple way to earn money.

If you think you and your family members also like to earn money in additional time, then go this link. In this site, you can earn money for the lifetime at low effort. To Earn Unlimited Everyday With This Trick, Sign Up Free.. Get Started for Free

Flyout is a free, simple way to earn money by placing sponsored content on your blog

Check Out:- Earn Unlimited Everyday With This Trick:- Click Here

FAQ (Frequently Asked Questions)

Final Output → To get source code lived demo, Click Here..

Hi, This is Vijay 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

Originally published at https://www.w3web.net on August 21, 2021.

--

--

Vijayk
Vijayk

Written by Vijayk

Easy to learn step-by-step online tutorial by www.w3web.net

No responses yet