How to check if a Date input is empty or null?


Yang Ghua

this code

not work!


DecSoft

Hello Joshua,

The Date input is a bit special in comparison with others. This is mainly because their "Value" are not an string, but a Javascript Date variable, so they can't be an "empty" string or "null" value, and this is why the above code doesn't work like in other inputs controls.

On the other hand, the behaviour of the Date input depend on the browsers' vendors implementation. For example, Firefox allow us to "erase" the input date/text (not the associated Date variable), but Chrome only allow us to change the date value to another. Other browsers like the Android's webview doesn't allow to write into the Date input, but offer an specific dialog to choose a Date value.

When we deal with the Date input we must create an App Builder's Date variable from the Input Value using the NewDate action. Then we can use all the Date related actions, for example, to get the selected or current Date input year, month, etc. Onh the other hand we must always validate the user's input in the server side if exists.

Hope this information can help you Joshua, please, go ahead if you have any further question.


Todo el mundo puede leer el foro de soporte de DecSoft para aprender del mismo, sin embargo, sólo los clientes de DecSoft pueden abrir nuevos hilos. Compre una o más licencias de productos de DecSoft y obtendrá este y otros beneficios.

Este sitio utiliza "cookies" útiles para almacenar sus preferencias.

Bien. Ocultar esta nota. Obtener más información.