Kal
Posts: 0
Joined: Thu May 22, 2014 11:03 pm

How to set a Radio Button label on the fly in JS using the Appery object

I have a radio button group called "dealGroup" with buttons "deal_1", "deal_2" etc.

I need to set the label on the fly at run time. I tried the usual jQuery trick like:

Appery("dealGroup").find("deal_1").next().text("My text");

But this does not work. Any help on how to do this?

Thanks,
-Kal.

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

How to set a Radio Button label on the fly in JS using the Appery object

Hi Kal.

Please follow this solution:

1 Open page in design mode and activate your certain radiobutton by clicking on it. http://prntscr.com/3tifac/direct

2 Properties side bar will appear. Select and copy this button name. http://prntscr.com/3tifp7/direct

3 Use following code to change label of this certain button.

pre

//Where "mobilecheckbox_18" - is your button name from 2nd step.
Apperyio("mobilecheckbox_18").find(".ui-btn").text("hello world")

/pre

That's all.

Regards.

Kal
Posts: 0
Joined: Thu May 22, 2014 11:03 pm

How to set a Radio Button label on the fly in JS using the Appery object

Thanks! I was missing that .find(".ui-btn") part.

Just out of curiosity, is there a way I could have figured out that part by myself? I googled a lot and did not find that particular thing. I would like to learn how to fish instead of just being given the fish ;)

Thanks,
-Kal.

Kal
Posts: 0
Joined: Thu May 22, 2014 11:03 pm

How to set a Radio Button label on the fly in JS using the Appery object

Also, another follow-up question, please...

How do I set the value of the radio button? I tried both of the following:

Appery("mobilecheckbox_18").find(".ui-btn").val(5);

and

Appery("mobilecheckbox_18").val(5);

Neither of those works.

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

How to set a Radio Button label on the fly in JS using the Appery object

Hi Kal.

Just one thing that i saw: you talked about "radiobutton" component but in code you've used "mobilecheckbox_18" name that's apparently belongs to the "checkbox" component.

Anyway.

In case if you need to get value from certain radiobutton item you can use following code:

pre

//Note: "mobileradiobutton_23" is your radiobutton item name.
Apperyio("mobileradiobutton_23").find('input[type="radio"]').val();

/pre

In case if you need to get value from certain checkbox item you can use following code:

pre

//Note: "mobilecheckbox_28" is your checkbox item name.
Apperyio("mobilecheckbox_28").find('input[type="checkbox"]').val();

/pre

Regards.

Return to “Issues”