Skip to Content
-1

SAPUI5 - How do I disable text input in DateRangeSelection

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?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Apr 12 at 11:46 AM

    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);
    

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 31, 2017 at 09:31 AM

    Hi,

    Try this.

    view.byId("__reportDate").setEnabled(false);
    Add comment
    10|10000 characters needed characters exceeded

  • Mar 04 at 05:04 PM

    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.

    Add comment
    10|10000 characters needed characters exceeded