Hi Experts,
I have created datetime input using XML code in SAPUI5. The code is below:
<Page title="Date Time Validation" showNavButton="true" >
<content>
<Label id="l1" text="Enter Date" visible="true" design="Bold" required="true" labelFor="dtTime"></Label>
<DateTimeInput id="dtTime" type="Date" displayFormat="dd/mm/yyyy"></DateTimeInput>
</content>
<footer>
<Bar>
<contentRight>
<Button
id="b1"
icon="sap-icon://bed"
press="Click"
/>
</Bar>
</footer>
</Page>
Now I want to show the date value as a message when click the button. This code I have written controller.js file. The code is below:
Click: function(oEvent)
{
alert("Today is:" + $("#dtTime").val() );
},
But output is coming as undefined. Below is screen shot in debug mode:
Why it is undefined? Kindly provide the solution. It will be very helpful for me.
I tried this code also:
//var shell = oEvent.oSource;
//var x = sap.ui.getCore();
//var dt = x.byId("dtTime").getValue();
This is also not working.
Thanks & Regards,
Arindam Samanta.