Java code for validating date
If your desire is to tell them exactly what is wrong with their entry, then my first suggestion would be to run the date entry through your own filter BEFORE you try to parse it into a Date. It would be better if I stop my execution soon after I get Parse Exception, and show a customized message saying invalid date. From your post, I did not understand about the filter that you were talking about. You then would have full control over the date entry, and can set your filter to watch out for not only non-existent dates, but dates that do not fit into any other criteria your application requires. But in my case, the requirement is, I need to be specific as to which field is entered wrong. and validating if the month entered is greater than max month and if day is greater than max day. DAY_OF_MONTH);int n Max Day = dt Actual Maximum(Calendar.DAY_OF_MONTH);int n Month = dt Calendar.get(Calendar. MONTH);int n Max Month = dt Actual Maximum(Calendar.
Based on the way you catch your exception, you should stop execution at the Exception and advise your user the date entry was invalid. (16 printed pages) Introduction Getting Started Writing the Validation Script Connecting the Form to the Script Associating Form Fields with Custom Script Code Listing Conclusion When you create forms, providing form validation is useful to ensure that your customers enter valid and complete data.For example, you may want to ensure that someone inserts a valid e-mail address into a text box, or perhaps you want to ensure that someone fills in certain fields.Microsoft® Office Front Page® 2003 allows you to create some custom validation within the form feature.(For more information on how to create form validation using the Front Page form feature, see About creating forms in Front Page 2003.) However, if the form validation provided in Front Page does not suit your needs or the site on which you are working is hosted on a server that does not have Front Page Server Extensions from Microsoft installed, you may need to create custom form validation.