[Shale] commons client side validation not picking up component name
Hi: When I use the commonsValidator for required on the client side, the name of the component is not being picked up and the alert says null is required. This happens with both h:inputText and h:selectOneListbox, the only two I have tried. h:inputText id=s_id size=16 value=#{su_menu.s_id} s:commonsValidator type=required server=true client=true / /h:inputText ... function required() { this[0] = new Array(su_menu:pi, null is required., new Function(x, return {}[x];)); } The server side validation works fine. I have added the onsubmit and validatorScript as suggested in the web page. Am I missing something obvious, like some library? Thanks in advance. mas - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [Shale] commons client side validation not picking up component name
From: Mark Shifman [EMAIL PROTECTED] Hi: When I use the commonsValidator for required on the client side, the name of the component is not being picked up and the alert says null is required. This happens with both h:inputText and h:selectOneListbox, the only two I have tried. h:inputText id=s_id size=16 value=#{su_menu.s_id} s:commonsValidator type=required server=true client=true / /h:inputText ... function required() { this[0] = new Array(su_menu:pi, null is required., new Function(x, return {}[x];)); } You are missing the arg attribute containing the description of the field. h:inputText id=s_id size=16 value=#{su_menu.s_id} s:commonsValidator type=required server=true client=true arg=My Field Name / /h:inputText Gary The server side validation works fine. I have added the onsubmit and validatorScript as suggested in the web page. Am I missing something obvious, like some library? Thanks in advance. mas - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [Shale] commons client side validation not picking up component name
Thanks Gary: I am now getting a much more insidious exception thrown. I using the following: h:inputText id=s_id size=16 value=#{su_menu.s_id} s:commonsValidator type=required server=true client=true arg=#{msgs.validate_s_id}/ s:commonsValidator type=float server=true client=true arg=#{msgs.validate_s_id} / /h:inputText I now get when I submit a float. java.lang.NullPointerException at org.apache.shale.validator.CommonsValidator.validate(CommonsValidator.java:525) at javax.faces.component._ComponentUtils.callValidators(_ComponentUtils.java:133) at javax.faces.component.UIInput.validateValue(UIInput.java:254) at javax.faces.component.UIInput.validate(UIInput.java:269) at javax.faces.component.UIInput.processValidators(UIInput.java:144) at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:417) at javax.faces.component.UIForm.processValidators(UIForm.java:68) at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:417) at javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:142) at org.apache.myfaces.lifecycle.LifecycleImpl.processValidations(LifecycleImpl.java:240) at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:76) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:106) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:284) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:204) at org.apache.shale.faces.ShaleApplicationFilter.doFilter(ShaleApplicationFilter.java:285) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:233) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:204) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:257) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567) at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:245) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:199) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:184) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:164) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:149) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:156) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:972) at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:206) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:833) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:732) at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:619) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:688) at java.lang.Thread.run(Thread.java:534) I get this error with both the old commons-validator shiped with the blank application and with commons-validator-1.3.0 thanks in advance. mas Gary VanMatre wrote: From: Mark Shifman [EMAIL PROTECTED] Hi: When I use the commonsValidator for required on the client side, the name of the component is not being picked up and the alert says null is required. This happens with both h:inputText and h:selectOneListbox, the only two I have tried. h:inputText id=s_id size=16 value=#{su_menu.s_id} s:commonsValidator type=required server=true client=true / /h:inputText ... function required() { this[0] = new Array(su_menu:pi, null is required., new Function(x, return {}[x];)); } You are missing the arg attribute containing the description of the field. h:inputText id=s_id size=16 value=#{su_menu.s_id} s:commonsValidator type=required server=true client=true arg=My Field Name / /h:inputText Gary The server side validation works fine. I have added the onsubmit and validatorScript as suggested in the web page. Am I missing something obvious, like some library? Thanks in advance. mas -
Re: [Shale] commons client side validation not picking up component name
From: Mark Shifman [EMAIL PROTECTED] Thanks Gary: I am now getting a much more insidious exception thrown. I using the following: h:inputText id=s_id size=16 value=#{su_menu.s_id} s:commonsValidator type=required server=true client=true arg=#{msgs.validate_s_id}/ s:commonsValidator type=float server=true client=true arg=#{msgs.validate_s_id} / /h:inputText java.lang.NullPointerException at org.apache.shale.validator.CommonsValidator.validate(CommonsValidator.java:525) This is a bug in the validator-rules.xml. The formal parameter of the isDouble method defines the parameter type as a double but it's actually a String. The validator entry should be: validator name=float classname=org.apache.commons.validator.GenericValidator method=isDouble methodParams=java.lang.String depends= msg=errors.float jsFunctionName=FloatValidations Please submit this as a bugzilla ticket but I have a workaround. The default validation-rules.xml is packaged in with the shale-core.jar but you can override this by a parameter in the web.xml. context-param param-nameorg.apache.shale.validator.VALIDATOR_RULES/param-name param-value/WEB-INF/validator-rules.xml/param-value /context-param Copy down the validator-rules.xml into your WEB-INF and change the methodParams to match the fragment above. http://svn.apache.org/viewcvs.cgi/struts/shale/trunk/core-library/src/conf/validator-rules.xml?view=markup Gary -- Mark Shifman MD. Ph.D. Yale Center for Medical Informatics Phone (203)737-5219 [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [Shale] commons client side validation not picking up component name
Thanks!! I will submit a bug ticket tomorrow. Looking at the validator-rules.xml it looks like a double validator has been completely omitted. mas Gary VanMatre wrote: From: Mark Shifman [EMAIL PROTECTED] Thanks Gary: I am now getting a much more insidious exception thrown. I using the following: h:inputText id=s_id size=16 value=#{su_menu.s_id} s:commonsValidator type=required server=true client=true arg=#{msgs.validate_s_id}/ s:commonsValidator type=float server=true client=true arg=#{msgs.validate_s_id} / /h:inputText java.lang.NullPointerException at org.apache.shale.validator.CommonsValidator.validate(CommonsValidator.java:525) This is a bug in the validator-rules.xml. The formal parameter of the isDouble method defines the parameter type as a double but it's actually a String. The validator entry should be: validator name=float classname=org.apache.commons.validator.GenericValidator method=isDouble methodParams=java.lang.String depends= msg=errors.float jsFunctionName=FloatValidations Please submit this as a bugzilla ticket but I have a workaround. The default validation-rules.xml is packaged in with the shale-core.jar but you can override this by a parameter in the web.xml. context-param param-nameorg.apache.shale.validator.VALIDATOR_RULES/param-name param-value/WEB-INF/validator-rules.xml/param-value /context-param Copy down the validator-rules.xml into your WEB-INF and change the methodParams to match the fragment above. http://svn.apache.org/viewcvs.cgi/struts/shale/trunk/core-library/src/conf/validator-rules.xml?view=markup Gary -- Mark Shifman MD. Ph.D. Yale Center for Medical Informatics Phone (203)737-5219 [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]