Page 1 of 1

Dynamically created Radio buttons value

Posted: Fri Feb 12, 2016 5:11 pm
by Joe Bohen

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


Dynamically created Radio buttons value

Posted: Fri Feb 12, 2016 6:50 pm
by Serhii Kulibaba

Hello,

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


Dynamically created Radio buttons value

Posted: Fri Feb 12, 2016 10:01 pm
by Joe Bohen

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.


Dynamically created Radio buttons value

Posted: Mon Feb 15, 2016 10:36 am
by Serhii Kulibaba

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

and read it on radio's value change event


Dynamically created Radio buttons value

Posted: Mon Feb 15, 2016 11:56 am
by Joe Bohen

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.


Dynamically created Radio buttons value

Posted: Mon Feb 15, 2016 12:54 pm
by Serhii Kulibaba

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


Dynamically created Radio buttons value

Posted: Mon Feb 15, 2016 1:24 pm
by Joe Bohen

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