I want to make an InputField
that only allows a specific date format to be entered.
I want to display a field hint in the format "dd:mm:yyyy". Once the user clicks on the input field, then the user should be able to enter date values. The user should not be able to enter anything that in not in the correct format. I require the ability to insert a separator of my choice. In the example above, my field separator is ":". The user should not be able to enter any other separator except for the one that I have given.
Edit (I have partitioned here to make it clear that longitude:latitude:wind:pressure was added after all the comments below and after my answer. MH)
Another problem that I'm faced with is: if I specify input fields to take a string, then I need to convert a lot of numbers to String and vice versa. I want to avoid that because in some cases I have 4 and more elements like longitude:latitude:wind:pressure
Can anyone help me?
InputField[Dynamic[var,(test[#])&],String,...]
wheretest
will be a test of the date string that is entered by the user to ensure that it conforms to your requirements. – Mike Honeychurch Feb 8 at 7:37String
type ofInputField
,again we have to convert string format to number format.so If you can useNumber
type ofInputField
,it does not allowstrings
,but it poses another problem of not allowing the specialCharacters. So that's why we have to customize ourInputField
. according to our needs. – subbu Feb 8 at 8:24