myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mert Çalışkan" <mcalis...@gmail.com>
Subject Re: InputDate Validation ?
Date Mon, 26 Jun 2006 11:40:23 GMT
I did a similiar thing for UIInput components before. With javascript calls
the user was only capable of inputting numeric characters.
You can use a javascript like that, but you should also check for the
keyCode for "." hence the code only checks for 0-9 numeric inputs.

http://www.jroller.com/page/mert?entry=disabling_non_numeric_character_input

Cagatay will you add scripting stuff like that to the client-side validation
of myfaces?
What's the plan?

Regards,

Mert


On 6/26/06, Cagatay Civici <cagatay.civici@gmail.com> wrote:
>
> Hi,
>
> This is because converter takes place before the validators.
>
> Maybe you could try some javascript tricks to disable user from submitting
> invalid data?
>
>
> Cagatay
>
>
> On 6/26/06, José Luis / Dpto Informatica <jlmm@torrecid.com> wrote:
> >
> >   Hi,
> >
> >
> >
> > Is there any way to validate what the user inputs in the InputDate control
> > ?
> >
> > If a user input a character in the day field then I get the next error :
> >
> >
> >
> > <pre>
> >
> > java.lang.NumberFormatException
> > : For input string: "A"
> >
> >         java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
> >
> >         java.lang.Integer.parseInt(Integer.java:447)
> >
> >         java.lang.Integer.parseInt(Integer.java:497)
> >
> >         org.apache.myfaces.custom.date.HtmlInputDate$UserData.parse
> > (HtmlInputDate.java:208)
> >
> >         org.apache.myfaces.custom.date.HtmlDateRenderer.getConvertedValue
> > (HtmlDateRenderer.java:277)
> >
> >         javax.faces.component.UIInput.getConvertedValue
> > (UIInput.java:289)
> >
> >         javax.faces.component.UIInput.validate(UIInput.java:265)
> >
> >         javax.faces.component.UIInput.processValidators(UIInput.java:144)
> >
> >         javax.faces.component.UIForm.processValidators(UIForm.java:68)
> >
> >         javax.faces.component.UIComponentBase.processValidators
> > (UIComponentBase.java:417)
> >
> >         javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:142)
> >
> >         org.apache.myfaces.lifecycle.LifecycleImpl.processValidations(LifecycleImpl.java:240)
> >
> >         org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:76)
> >
> >         javax.faces.webapp.FacesServlet.service(FacesServlet.java:106)
> >
> >         org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(ExtensionsFilter.java:122)
> >
> >         org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:362)
> >
> > </pre>
> >
> >
> >
> > I've tried writing a validator method in mi backing bean but before I
> > could read the new value the error has already been tigered.
> >
> >
> >
> > Thank you very much in advance.
> >
> >
> >
> >
> >
>
>

Mime
View raw message