0

Im a newbie on JSF

I want to validate the date the user is adding on the "Calendar",

using the event "KeyUp" and ajax, but, it doesn't work. anyone can help me?

Thanks .

<p:calendar id="fechaNacimiento" value="#{funcionarioController.funcionario.persona.fechaNac}"
                               pattern="dd/MM/yyyy" yearRange="c-60:c" navigator="true" locale="es" showOn="button" 
                               size="30" maxlength="10" maxdate="#{personaController.fecha}"
                               required="true" requiredMessage="Ingrese su Fecha de Nacimiento">
        <f:convertDateTime pattern="dd/MM/yyyy" timeZone="#{personaController.timeZone}"/>
        <f:validator validatorId="de.common.DateValidator" />
        <p:ajax event="dateSelect" listener="#{funcionarioController.dateChange}" update=":acpCv:messages"/>  
       <p:ajax event="keyup" update="" listener="#{funcionarioController.validateDate}"/>
</p:calendar>

and my controller JAVA :

public void validateDate(){
        System.out.println("Validation Date");
    }
Kukeltje
  • 12,223
  • 4
  • 24
  • 47
Elmer
  • 370
  • 1
  • 5
  • 21
  • You can't hava a jsf-1.2 and 2/2.2 tag at the same time. And you already have a date validator… what does that do and why additional validation in the controller? And desvribe 'does not work' from a developer point of view – Kukeltje Jul 29 '15 at 20:32
  • sorry the version I use is the 2 , sorry. – Elmer Jul 29 '15 at 20:36
  • sorry , but part of that validation, I want the function "validateDate" run when the user types will not print date ... and not shows the message within the function – Elmer Jul 29 '15 at 20:42
  • This question doesn't make any sense. The term "validate" is misplaced and too ambiguous. What exactly are you trying to validate and why exactly are you doing it in an action method instead of a validator? Are you absolutely sure that you mean "validate" and not "convert"? The calendar component will namely only convert from string to date object and validators run only after converter. It can impossibly already give you a whole date object for validation after entering only 1 character. What problem exactly are you actually trying to solve in this XY-problem? – BalusC Jul 30 '15 at 05:57

0 Answers0