How to validate the value of a calandar without submitting?

UI Components for JSF
Post Reply
rym
Posts: 23
Joined: 22 Jun 2011, 16:46

23 Jul 2011, 12:55

I'am using JSF2.0/primefaces,

I want to validate a date choosen from a calandar:

<p:calendar value="#{bean.date1}" style="width: 50px" showOn="button" />

but I want that the validation will be done without submitting the result , what I want is that when I will choose the date and it dont exists in the database a message(like msg box) will be dispalys to the user. I have write a function that test if the date exists in the database but I don't know what I should do next!

public void validateDate() throws ParseException
{
FindIssue fdate=new FindIssue();
ArrayList<String> listdate=fdate.FindListdateCreation();
Iterator itdate=listdate.iterator();
while (itdate.hasNext())
{
DateFormat out = new SimpleDateFormat("yyyy-MM-dd");
String date=out.format(itdate.next());

if(!date.equals(formatingDateTime(date1)))
{
System.out.println("invalide date ");
}

}
}

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 50 guests