Hawk
Posts: 0
Joined: Mon Aug 04, 2014 11:23 am

Cannot read the selected radio button into localstorage

I am using the following JS on "value change" for radio group that locates in a panel:

code
var checkedRadio = Appery("mobileradiogroup_215").find(":checked").val();
localStorage.setItem("month", checkedRadio);
/code

I need to copy the value of the selected button (regardless which one is selected) into the LSV. The radiogroup name is correct, and LSV is created and had a value of "To Date" by default. However, when I click on any button , LSV gets the value "undefined" (I monitor it using chrome dev tools).

The value that I need to copy is the value I set here:

Image

Is there anything wrong in my JS?

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Cannot read the selected radio button into localstorage

Hi Hawk,

You could set localStorage variable value on Value change event as follows:
Image

Hawk
Posts: 0
Joined: Mon Aug 04, 2014 11:23 am

Cannot read the selected radio button into localstorage

Hi Kateryna,

I followed that :

Image

And I wanted to check the value stored in the LSV, so I added:

Image

However, when I check any of the radio button, the alert returns "null" value !

To reproduce:
Link: http://appery.io/app/mobile-frame?src...

credentials: 1234/star1234

Navigate: NavBar: Points -- click on the button (2) in described in the screenshot below, panel will open, which contains the radiogroupbuttons.

Image

Image

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

Cannot read the selected radio button into localstorage

Hello Hawk,

I don't see that some variable appeared with ls, and therefore it receives null,
Could you please send us the screenshots of all the events together?

Laura Eadie
Posts: 0
Joined: Wed Mar 04, 2015 11:12 am

Cannot read the selected radio button into localstorage

Try this:

var checkedRadio = $( '.ui-radio-on' ).parent().find('input').val();

Return to “Issues”