Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not show datepicker for readonly inputs #1136

Merged
merged 1 commit into from Dec 30, 2014

Conversation

kix
Copy link
Contributor

@kix kix commented Oct 27, 2014

Currently, calling $(el).datepicker() on a readonly input (<input type="text" readonly/>) enables users to modify its content. This patch disables the datepicker popup from showing when an <input/> is readonly.

@acrobat
Copy link
Member

acrobat commented Dec 30, 2014

Thanks @kix!

acrobat added a commit that referenced this pull request Dec 30, 2014
Do not show datepicker for readonly inputs
@acrobat acrobat merged commit 7cdcce9 into uxsolutions:master Dec 30, 2014
@acrobat acrobat added this to the 1.4.0 milestone Dec 30, 2014
@acrobat acrobat mentioned this pull request Dec 30, 2014
6 tasks
@MuyBien
Copy link

MuyBien commented Feb 4, 2015

This code will not work if the datepicker class is append to a div (as in this example with the component : http://eternicode.github.io/bootstrap-datepicker/?markup=component&format=&weekStart=&startDate=&endDate=&startView=0&minViewMode=0&todayBtn=false&clearBtn=false&language=en&orientation=auto&multidate=&multidateSeparator=&keyboardNavigation=on&forceParse=on#sandbox).
I came up with this code. I think it needs to be changed before merged but it works :

    var dateInput = this.isInput ? this.element : this.element.find("input");
    if (dateInput.attr('readonly'))
        return;

I didn't modify the this.element because it will not work in the case you click the component element (this.element = [])

@natsu90
Copy link

natsu90 commented Feb 26, 2015

It should be disabled on disabled attribute, instead of readonly. Readonly is useful to disallow user to edit datepicker input directly; 02/26/201 is treated as a valid date.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants