Joe Bohen
Posts: 0
Joined: Wed Nov 28, 2012 11:28 am

Dynamically created Radio buttons value

With support from Sergiy I have created some radio button groups by mapping to an array. I am able to get the values by looping through all radio buttons after they have been set but I need to know when a fault button is clicked and what value is held for the button. part of the generated html is below I have omitted the table structure that wraps around each fieldset. Can you tell me how I would obtain the values on the click event.

Code: Select all

                                         <!-- mobileradiobutton_9 -- 

span class="vehicle_check_page_mobileradiobutton_9" name="mobileradiobutton_9"

/spanOK
<!-- mobileradiobutton_10 --
span class="vehicle_check_page_mobileradiobutton_10" name="mobileradiobutton_10"

/spanFault

<!-- mobileradiobutton_9 --
span class="vehicle_check_page_mobileradiobutton_9" name="mobileradiobutton_9"

/spanOK
<!-- mobileradiobutton_10 --
span class="vehicle_check_page_mobileradiobutton_10" name="mobileradiobutton_10"

/spanFault

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Dynamically created Radio buttons value

Hello,

Could you clarify, do you generate dynamically radio buttons or radiogroups? Please add mapping to the radio component instead of radiogroup.

Joe Bohen
Posts: 0
Joined: Wed Nov 28, 2012 11:28 am

Dynamically created Radio buttons value

Hi Sergiy,

My mappings are to the radio component but I wish to have only two options n the generated buttons Ok and Fault so the values for theses are being generated by a static text value which I am setting in the js as in return 'OK'; I am also setting the value to a unique value and it is this that I need to get at when one of the radio buttons is clicked.

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Dynamically created Radio buttons value

You can set value as an attribute of the radiogroup: https://devcenter.appery.io/documenta...

and read it on radio's value change event

Joe Bohen
Posts: 0
Joined: Wed Nov 28, 2012 11:28 am

Dynamically created Radio buttons value

I am setting a value, and doing this in the change event: var val=$(this).val(); and I get nothing back. Will you show me the code that you would use.

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Dynamically created Radio buttons value

Did you set an attribute to the radio button?

Do you want to have list of radio buttons like that http://prntscr.com/a3j2sq ? If so - please use steps below:
1) Add HTML component to tha page, and set it's Type=div, Dimension= auto/auto
2) Put radiogroups inside of that component and set it's Orientation=horizontal
Each radio should have Text and value=Fault or OK
3) Add service's mapping to that component: http://prntscr.com/a3j4cr
4) Set JS below to that mapping:
preelement&#46;find("input")&#46;attr("data-id", value&#46;_id);/pre
5) Add JS to the event "value change" of these radio buttons:
var id = $(this).find("input").attr("data-id");
var value = $(this).find("input").val();
use these variables wherever you want

Joe Bohen
Posts: 0
Joined: Wed Nov 28, 2012 11:28 am

Dynamically created Radio buttons value

Hi Sergiy,

Thank you for your support every aspect of my app was OK It was only the final jquery selector that I was missing everything is working fine now.

Regards,
Joe

Return to “Issues”