I have a view ..
<mvc:View controllerName="quiz.controller.View1"
xmlns:mvc="sap.ui.core.mvc"
xmlns="sap.m"
displayBlock="true"
>
<App>
<Page title="{i18n>title}">
<Text text="{questions>/question/text}" />
<RadioButtonGroup columns="5">
<RadioButton id="RB3-1" text="{questions>/question/option/1}" />
<RadioButton id="RB3-2" text="{questions>/question/option/2}" />
<RadioButton id="RB3-3" text="{questions>/question/option/3}" />
<RadioButton id="RB3-4" text="{questions>/question/option/4}" />
</RadioButtonGroup>
<Button text="Default" press=".onPress" />
</Page>
</App>
</mvc:View>
.. in which there is a radio button group with four options. I was looking to display one of the radio buttons as selected as soon as the button is pressed.
sap.ui.define([
"sap/ui/core/mvc/Controller",
"sap/m/MessageToast"
], function(Controller, MessageToast) {
"use strict";
return Controller.extend("quiz.controller.View1", {
onPress: function(evt) {
// MessageToast.show(); over here I want to show the button which is pressed
}
});
});
How do I do it? I tried by using document.getElementById() but it's not working here.