Page 1 of 1

Get the selected value from Radio Select

Posted: Thu Jan 09, 2014 12:04 pm
by Jordi Niubo

Hi

I have the UI component Radio and one button

I have some options on the radio.

I need to save as local variable the option selected on the radio and run this when i click on the button.

I have this JS in the button.

var a = $('[name=radio_list]').val();
localStorage.setItem('_value', a);

All time only have the first option. If I no have item selected i have the first option too.

What is the correct function ?

Thanks


Get the selected value from Radio Select

Posted: Thu Jan 09, 2014 2:18 pm
by Kateryna Grynko

Hi Jordi,

You can use this JS:prevar val = Appery("mobileradiogroup").find(":checked").val();/preWhere 'mobileradiogroup' is a name of radiogroup component.


Get the selected value from Radio Select

Posted: Fri Jan 10, 2014 8:38 am
by Jordi Niubo

thanks Katya :)


Get the selected value from Radio Select

Posted: Fri Jan 10, 2014 9:25 am
by Jordi Niubo

One more question about this.

When i use the Radio select, how can i reset it with no option selected? And how can i change with JS the option to other?

I know how to do this with Select but it's different for Radio.

Thanks for your time


Get the selected value from Radio Select

Posted: Fri Jan 10, 2014 9:58 am
by Kateryna Grynko

Hi Jordi,

You can use this code:preAppery("mobileradiogroup").find(":checked").attr("checked", false);/pre


Get the selected value from Radio Select

Posted: Fri Jan 10, 2014 12:19 pm
by Jordi Niubo

thanks Katya this change the value. Then need to refresh the "mobileradiogroup" with .checkboxradio("refresh");

I will try to change the option selected with other button now

thanks


Get the selected value from Radio Select

Posted: Fri Jan 10, 2014 1:00 pm
by Kateryna Grynko

Jordi,

Let us know if you need any help.


Get the selected value from Radio Select

Posted: Mon Jan 13, 2014 9:32 am
by Jordi Niubo

for any one who have this problem here is one solution:

$('input:radio[name="list"]').filter("[value="+input+"]").prop("checked", true).checkboxradio( "refresh" );