Home > Software design >  Datepicker input text
Datepicker input text

Time:12-16

Iam using a datepicker field, I could add text inside the field even after giving the date.

How do we restrict user to enter alphabets in a datepicker field?

I tried with singleinputs=false

CodePudding user response:

If you change the onkeydown event the user won't be able to add additional values, it will only allow to pick Date values as intendend.

<input onkeydown="return false" .../>

CodePudding user response:

WPF Datepicker to disable user input

nice solution before, probably as mentioned in above url

                    <DatePicker x:Name="dp1"   Grid.Column="2" HorizontalAlignment="Left" Margin="532,105,0,0" VerticalAlignment="Top">
                        <DatePicker.Resources>
                            <Style TargetType="DatePickerTextBox">
                                <Setter Property="IsReadOnly" Value="True"/>
                            </Style>
                        </DatePicker.Resources>
                    </DatePicker>
  • Related