Skip to Content
-1

SAPUI5 - How do I disable text input in DateRangeSelection

Oct 30, 2017 at 07:24 PM

108

avatar image

I need to completely disable text entry on a DateRangeSelection, so that only the calendar selection can be accepted..

I can the disable text input for a DatePicker component with...

view.byId("__reportDate")._bMobile = true;

Unfortunately this doesn't work for a DateRangeSelection.

Is there anything else I can try?

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Irfan Gokak Oct 31, 2017 at 09:31 AM
0

Hi,

Try this.

view.byId("__reportDate").setEnabled(false);
Share
10 |10000 characters needed characters left characters exceeded
Iftah Peretz
Mar 04 at 05:04 PM
0

Hi,

If I understand correctly what you are asking, then I would incorporate a validly check once the user is entering the value to match the DatePicker format. If you, for some reason, want to not allow it, you would need to have a ghost field (or a button that opens the DatePicker - I think it's feasible) that only its DatePicker is visible and that upon entering a value from it you would pass it to your original field that is enabled, as Irfan Gokak suggested.

Share
10 |10000 characters needed characters left characters exceeded
Irfan Gokak Apr 12 at 11:46 AM
0

Hi,

I done as below for DatePicker.

var oDatePicker = this.getView().byId("docdt");
			oDatePicker.addEventDelegate({
				onAfterRendering: function() {
					var oDateInner = this.$().find('.sapMInputBaseInner');
					var oID = oDateInner[0].id;
					$('#' + oID).attr("disabled", "disabled");
				}
			}, oDatePicker);

Share
10 |10000 characters needed characters left characters exceeded