Page 1 of 1

Get checked mobile radio button text

Posted: Sat Jul 12, 2014 6:35 am
by Cody Blue

I am mapping a service to a radiogroup and want to get text of the the checked radio button. I was suggested the following code which was working completely fine, but after migrating to V2.0 libs this no longer works for me.

Could you suggest what is wrong - I've also posted this to support@appery with a bit more background and steps to replicate the problem in my project.

Many thanks - look forward to your feedback!

//execute on success of event:
$('[dsid="RadioButton"]').eq(1).find('input').prop("checked", true).checkboxradio("refresh");
//and this code to read value of checked button
var addr = $('input[name=RadioGroup]:checked').next().find(".ui-btn-text").html();


Get checked mobile radio button text

Posted: Sat Jul 12, 2014 2:02 pm
by Alena Prykhodko

Hello Cody,

Please check API examples for Radio button in this doc http://devcenter.appery.io/documentat...


Get checked mobile radio button text

Posted: Sat Jul 12, 2014 3:55 pm
by Cody Blue

Alena.

I had checked the documentation. I need to get the text associated with the checked radio button. I have tried all following combinations, and get an empty response.

alert($('input[name=RadioGroup]:checked').next().text());
alert($('input[name=RadioGroup]:checked').text());
alert($('input[name=RadioGroup]:checked').next().find("ui-btn").html());

What do you suggest? Thank you for your prompt feedback!!

As indicated, I've also sent an email to appery@support to reproduce the issue.


Get checked mobile radio button text

Posted: Sat Jul 12, 2014 4:22 pm
by Alena Prykhodko

Cody,

For Radio button group on Value change event run this JavaScript:
prealert($('input[name=radio_group]:checked').val());/pre

Where radio_group - you Radio button group name


Get checked mobile radio button text

Posted: Sat Jul 12, 2014 4:42 pm
by Cody Blue

Alena,

I do not need the value associated with the button, what I need is the text (which is mapped by a rest service to the radiogroup).

I am going to send an email to support@appery pointing out the details.

Could you then pls advise at your earliest convenience?
Regards.


Get checked mobile radio button text

Posted: Mon Jul 14, 2014 3:47 am
by Yurii Orishchuk

Hi Cody,

Please use following code to get selected radiobutton text:

pre

//Note: you need replace: "radioGroupComponentName" with your component name.
var selectedRadioText = $('input[name=radioGroupComponentName]:checked').closest("div").find("label").text().trim();

alert("selectedRadioText = " + selectedRadioText);

/pre

Regards.