danielmoncada / date-time-picker

Angular Date Time Picker (Responsive Design)
https://daniel-projects.firebaseapp.com/owlng/date-time-picker
MIT License
141 stars 61 forks source link

How can I disable input so user don't type #88

Closed Applicafroguy closed 3 years ago

Applicafroguy commented 3 years ago

I have an issue where the user tries to edit or type on the input field. This causes the date to be invalid.

When I do this the <input /> is disabled it's not clickable

<input readonly [owlDateTimeTrigger]="dt3" [owlDateTime]="dt3" [disabled]="true" formControlName="pickup_time" name="pickup_time" class="nordex-input placeholder-gray-700" id="pickup_time" placeholder="9:54 AM" /> <owl-date-time [pickerType]="'timer'" disabled #dt3></owl-date-time>

This is my FormGroup settings

pickup_time: [{ value: '', disabled: true }],

This is the results

input

I want the user to pickup time, but not allowed to manually update the <input />

f3l1xss commented 3 years ago

@Applicafroguy Did you manage to resolve this? I am currently facing the same problem

f3l1xss commented 3 years ago

Since it appears that the disabled attribute does not work, I 'fake' disabled the timer input using css:

https://stackoverflow.com/questions/5963099/how-do-i-disable-form-fields-using-css .owl-dt-timer-content { pointer-events: none; }