html5 date imput – disable date manual input

Backer | 94

hi i have this date field in my form

        $tomorrow = DateTime::from(0)->modifyClone('+1 Day')->format('Y-m-d');
        $rezervaceForm->addText('datum', 'datum')
            ->setHtmlAttribute('min', $tomorrow)

how can i disable to manual input the date to the edit
i need enabled only pick from calendar

thank you

Member | 553

use JS/jQuery etc.

Member | 493

@thcom It's not possible. There is a hack, but when user has browser which doesn't support input[type=date], the input stops working at all for such user.

But I'm wondering – why would you need to disable it? If you have reservation system, you should check on backend that valid date was given, disabling manual mode is not enough.

From the user point of view – when I make reservation, I always click the calendar to see what dates are available. If I make a blind-shot and type date there, it's my problem that server returns an error after submitting the form. But I guess that would be quite rare use-case.

Last edited by dakur (2021-09-14 10:10)