By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,805 Members | 1,350 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,805 IT Pros & Developers. It's quick & easy.

find if selected date already exists

P: 1
i am new in my project there is two rich calendar for select from date and select todate by users.if user going to select from date which date is already selected by user then how can i show error message that your selected date is already exist! thanks in advance
Apr 17 '13 #1
Share this Question
Share on Google+
1 Reply

P: 13,264
You can do this server side or client side. For client side add

Expand|Select|Wrap|Line Numbers
  1. ondateselected="validateDate();" oninputchange="validateDate();"
to your rich calendar tag. Then add the javascript

Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
  2. function validateDate() {
  3.     var choosenDate = $("yourForm:yourCalendar").component.getCurrentDate();
  4. //do your client side validation logic here
  7. }
  8. </script>
For server side you register an f:validator for your calendar and implement the Validator interface to throw a ValidatorException when the date is not allowed.
Apr 17 '13 #2

Post your reply

Sign in to post your reply or Sign up for a free account.