Opened 10 years ago

Closed 10 years ago

Last modified 6 years ago

#8001 closed bug (notabug)

Readonly parameter ignored by datepicker

Reported by: brunobg Owned by:
Priority: minor Milestone: 1.9.0
Component: ui.datepicker Version: 1.8.16
Keywords: Cc:
Blocked by: Blocking:


If a input tag has the readonly parameter set to true, datepicker still works and changes its value. This differs from disabled, because readonly still posts the form data but disabled does not.

How to reproduce: <input class="datepicker" readonly="readonly" type="text"/>

This seems to be somewhat related to #5644. Proposed fix: alter _connectDatepicker() and append at its end the following code:

if( input.attr('readonly')) {
    this._disableDatepicker( target );

and change ._disableDatepicker so that it does not call these lines if readonly is enabled:

target.disabled = true;
each(function() { this.disabled = true; }).end().
filter('img').css({opacity: '0.5', cursor: 'default'});

Change History (3)

comment:1 Changed 10 years ago by Scott González

Resolution: invalid
Status: newclosed

This is as designed. Don't enable the datepicker if you don't want users choosing dates.

comment:2 Changed 6 years ago by serhio

If I don't enable the datapicker, I am not able to send data via a POST request.

I need to send data of a value of datepicker, but not allow users to modify its value.

A DISABLED datepicker does not send any data to POST requests ((

comment:3 Changed 6 years ago by Scott González

I really don't know what you're referring to. Attaching the datepicker does nothing in terms of what fields are submitted. You should use the forums, IRC, or Stack Overflow for support.

Note: See TracTickets for help on using tickets.