Page 1 of 1

How to map selected radio button's text to backend service request

Posted: Thu Mar 28, 2013 2:34 pm
by Zaki Mohzani

I have a radio list and a button to submit the result to the backend service.

So the code does the following:

  1. Populate the radio list from backend service

  2. User selects the radio button of his choice

  3. Clicks on a button

  4. a 'create service' runs to submit the selection to the backend service.

    However, instead of the selected radio button's text being sent, 'Item 1' shows up on the collection.

    How can I map the selected radio's text instead of whatever is being sent.


How to map selected radio button's text to backend service request

Posted: Thu Mar 28, 2013 3:38 pm
by Maryna Brodina

Hi, working on it. I'll update.


How to map selected radio button's text to backend service request

Posted: Thu Mar 28, 2013 4:25 pm
by Maryna Brodina

Please check whether you have correct mapping

Image


How to map selected radio button's text to backend service request

Posted: Thu Mar 28, 2013 4:28 pm
by Maryna Brodina

Selected property of Radio Group component keeps selected element value . We tested - it works with the mapping showing above.


How to map selected radio button's text to backend service request

Posted: Sat Mar 30, 2013 1:45 am
by Zaki Mohzani

Thanks guys, that worked.

The mistake I did was to map data from the DB to the radio buttons where only the 'Text' field was assigned.

To fix it, I made sure the data from the DB also mapped to the 'Value' field.


How to map selected radio button's text to backend service request

Posted: Sat Aug 03, 2013 11:46 am
by Tom6106181

And how to do it the other way around? To map the selected value from DB to the radio buttons?

in my example: I have an EDIT USER = Gender (male/female). I can not figure out how to set the correct button selected when retrieving the current "gender" from DB. Any suggestions?

-Tom


How to map selected radio button's text to backend service request

Posted: Mon Aug 05, 2013 7:25 am
by Kateryna Grynko

Hi Tom,

Create mapping to JavaScript variable (if you need to store the value use localStorage) and add for it JavaScript code that looks like the following:
precode
if (value == "female") {
Appery( "mobileradiobutton_female" ).setAttr("checked", "checked");
} else {
Appery( "mobileradiobutton_male" ).setAttr("checked", "checked");
}/code/pre