Hi
i am using outsaystems datepicker control and i am using seteditableinput at oninitialize of Datepicker for this reason this field user can enter but i have mentioned the date format like below but stull user is able to enter any data in textbox.any thing i am missing.
in service studio
In UI
Hello @Arkyadeep Bharadwaj
I have made some changes in JS to strictly follow the date format. You can check here and let me know any changes you want
https://personal-eewexkfl.outsystemscloud.com/TestDatepicker/test
Thanks
Gourav Shrivastava
Hii @Arkyadeep Bharadwaj,
I’m unable to replicate this issue on my end; the Date Picker appears to be working as expected.could you please share oml file.
Thank you
@Rounak Rawat : It is reproducable for that you need to set DatePickerSetEditableInput with Id of the DatePicker ( not the id of the text box inside it)
@Arkyadeep Bharadwaj : Looks like this is by design. May be using some Js this could be prevented. btw what I have observed is as soon as the focus is lost the invalid values are cleared. . Let’s wait to see if someone has a workaround.
yes you are correct i think we have to restrict the input with help of JS.let me check.
I attached Js that seems working - prevent text input and accept only numbers and auto format ( Note : AI. generated code and use it with caution). Please see if it works for you.
Note : Input to this Js should be Id of DatePicker not the Id of the text input.
Hi @Arkyadeep Bharadwaj,
Let's first understand that DatePicker is not an equivalent of Input validator.
The DatePicker is essentially:
Until validation happens:
Secondly, DateFormat is NOT an input mask. When you set:
TextDateFormat = "dd/MM/yyyy"
This means:
It does not prevent writing any text in the text input.
Solution: There are a couple of ways to handle this:
Option 1: Validate on Change / On Blur
Add custom validation when the value changes.
Example logic (Reactive):
Option 2: Make it calendar‑only (strict)
Option 3: Use a masked Text Input alongside DatePicker
Hope this helps,
Cheers,
Saugat
I have gone through the documentation.i have added Javascript already.now it's working fine.user can enter only dd/mm/yyyy format now.i was thinking that this date format only it will accept if user entered.
Please ensure to mark the correct response as solution. This helps community members to directly reach for solution in case they come across similar issue.
i unmarked your solution because i tried with solution 1 and solution 3 both are not working.i have attached my OML file.can you please check and revert back.if i miss anything please let me know.if it will work i will mark your reply as solution.
One more thing, if you don't want post-validation of dates and month you can replace this code in js block, so you will get instant validation of invalid dates
its working fine.thanks for your support.