We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

how to set a default value to radio button so that it is checked

Thread ID:

Created:

Updated:

Platform:

Replies:

144429 May 6,2019 10:57 AM UTC May 9,2019 10:35 AM UTC Angular - EJ 2 3
loading
Tags: RadioButton
thowfik
Asked On May 6, 2019 10:57 AM UTC

how to set a default value to radio button so that it is checked and also on change of radio button i need to get the value of radio button selected
for example if i have a radio buttons
1.net banking 
2.debit card 
3.cash

by default debit card must be checked and also on change of debit card to net banking i need to get the value of selected item (i.e)net banking

Thanks in Advance
Regards 
Thowbik

Vinoth Kumar Sundara Moorthy [Syncfusion]
Replied On May 6, 2019 01:30 PM UTC

Hi Thowfik, 
 
Thank you for contacting Syncfusion support. 
 
We have checked your reported requirement “To set the default value and get the selected value in radiobutton” and it can be achieved in our EJ2 RadioButton using “checked” property and getSelectedValue method as like as below.  
 
Code example 
<ejs-radiobutton label="Net Banking" name="payment" value="netbanking" checked="true">ejs-radiobutton> 
 
btnClick(){ 
    alert(this.radioButton.getSelectedValue()); // To get the selected value 
} 
 
For your convenience, we have prepared the sample based on your requirement. Please find the link below. 
 
 
Could you please check the above sample and get back to us, if you need any further assistance on this? 
 
Regards, 
Vinoth Kumar S 


thowfik
Replied On May 9, 2019 06:22 AM UTC

instead of onclick i need to get the selected value on change of radio button.

Thanks in advance

Regards
Thowbik

Vinoth Kumar Sundara Moorthy [Syncfusion]
Replied On May 9, 2019 10:35 AM UTC

Hi Thowbik, 
 
Good day to you. 
 
We have modified the previously updated sample to achieve your requirement “To get the changed value in RadioButton” using RadioButton change event as like in the below code example, 
 
[HTML
<ejs-radiobutton #radiobutton label="Credit/Debit card" name="payment" value="credit/debit" (change)=onchange($event)></ejs-radiobutton> 
 
[TS
onchange(args){ 
    //To get the changed value 
    alert(args.value); 
} 
 
 
Could you please check the above sample and get back to us if you need any further assistance on this? 
 
Regards, 
Vinoth Kumar S 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon