How do I get the value of a text field when its type is set to Date?


#1

Till now, it’s possible to get the value via MOUSE ENTER/EXIT. But ON TEXT CHANGED failed.


#2

This has been a bug since forever in Axure, at least since they offered options of text field types. For example, this thread:

Because the Text Field widget is an HTML widget, it’s behavior and a good bit of styling are up to the browser (good and/or bad thing, depending on what you need in your prototype.) There is a similar issue with setting (programmatically changing) the text value in non-default Text Field types. Axure support had a response in this thread:

The problem as I see it is there just isn’t an event handler available when the user changes the value via “dropdown menu” (like the popup calendar for Date type, or spinner for Number type.) No event gets triggered, so Axure doesn’t know about it. It definitely seems like something due to both the browser and Axure, and I expect anything Axure could do about it might likely work in limited environments (OS + Browser + version) and would be subject to breaking anytime a browser updated its version.

Here is a little demo of how different “input types” of text fields work and don’t work. Years ago I had to deal with this for numeric input and date input, and I discovered the Text Changed event does get triggered if you manually type in a date, or pick a date via “browser calendar / date picker” and then press the Enter key (at least in Chrome browser on Win10/11). Setting the date just doesn’t seem to work though.
Text Field Input Types Demo.rp (53.2 KB)

The workaround has been to manually create your own date picker or date formatter/validation using the default input type of Text. It can get pretty complex, unfortunately. Here is a solution from RP8 …I expect it still works for RP9. I don’t know if any of this has been improved in RP10.

This approach from @nkrisc looks promising, if you’re familiar with javascript injection. …I haven’t tried it yet