Re: Possible client side validation bug in Struts 2.3.15
Solved, please check with the latest build ... hm ... ale the build are gone :\ https://builds.apache.org/view/S-Z/view/Struts/ Regards -- Łukasz + 48 606 323 122 http://www.lenart.org.pl/ 2013/7/11 Bruno Klava bkl...@gmail.com: Issue created: https://issues.apache.org/jira/browse/WW-4139 On Wed, Jul 10, 2013 at 6:18 AM, Lukasz Lenart lukaszlen...@apache.orgwrote: 2013/7/10 Lukasz Lenart lukaszlen...@apache.org: 2013/7/5 Bruno Klava bkl...@gmail.com: As far as I can tell, this difference is due to changes made in org.apache.struts2.components.Form.getValidators(String name) I would say that now is ok and previously it was a bug ;-) But you are right, that breaks backward compatibility Could you register an issue with link to the example? Thanks in advance -- Łukasz + 48 606 323 122 http://www.lenart.org.pl/ - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- Bruno Klava - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Possible client side validation bug in Struts 2.3.15
Issue created: https://issues.apache.org/jira/browse/WW-4139 On Wed, Jul 10, 2013 at 6:18 AM, Lukasz Lenart lukaszlen...@apache.orgwrote: 2013/7/10 Lukasz Lenart lukaszlen...@apache.org: 2013/7/5 Bruno Klava bkl...@gmail.com: As far as I can tell, this difference is due to changes made in org.apache.struts2.components.Form.getValidators(String name) I would say that now is ok and previously it was a bug ;-) But you are right, that breaks backward compatibility Could you register an issue with link to the example? Thanks in advance -- Łukasz + 48 606 323 122 http://www.lenart.org.pl/ - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- Bruno Klava
Re: Possible client side validation bug in Struts 2.3.15
2013/7/5 Bruno Klava bkl...@gmail.com: As far as I can tell, this difference is due to changes made in org.apache.struts2.components.Form.getValidators(String name) I would say that now is ok and previously it was a bug ;-) But you are right, that breaks backward compatibility Regards -- Łukasz + 48 606 323 122 http://www.lenart.org.pl/ - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Possible client side validation bug in Struts 2.3.15
2013/7/10 Lukasz Lenart lukaszlen...@apache.org: 2013/7/5 Bruno Klava bkl...@gmail.com: As far as I can tell, this difference is due to changes made in org.apache.struts2.components.Form.getValidators(String name) I would say that now is ok and previously it was a bug ;-) But you are right, that breaks backward compatibility Could you register an issue with link to the example? Thanks in advance -- Łukasz + 48 606 323 122 http://www.lenart.org.pl/ - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Possible client side validation bug in Struts 2.3.15
Hi, I get these two warnings: 2013-07-10 16:42:45,683 WARN (com.opensymphony.xwork2.interceptor.ParametersInterceptor:56) - Parameter [struts.enableJSONValidation] is on the excludeParams list of patterns! 2013-07-10 16:42:45,683 WARN (com.opensymphony.xwork2.interceptor.ParametersInterceptor:56) - Parameter [struts.validateOnly] is on the excludeParams list of patterns! How can I fix it ?! I put below in struts.xml constant name=struts.enableJSONValidation value=true / But it did not help. ~Regards, ~~Alireza Fattahi
Re: Possible client side validation bug in Struts 2.3.15
Now I managed to create a minimal example that reproduces the error (the previous example I was trying was too minimal :) https://github.com/bklava/struts In the example, in the index action/page, there are 2 forms: the difference is that the form 1 submits to the action without setting a method (then calling the default execute() method), while the form 2 submits to the same action but calling a specific method. The validator is set annotating the field setter method, so it should be available either to the default execute method and to the non-default method. This is exactly the behaviour obtained when using Struts 2.3.14.3. After switching to Struts 2.3.15, the form 2 validation is not executed at all. As far as I can tell, this difference is due to changes made in org.apache.struts2.components.Form.getValidators(String name) If you need any further info, just ask. Tnx! Bruno On Thu, Jul 4, 2013 at 4:25 PM, Bruno Klava bkl...@gmail.com wrote: Hi Maurizio, is was generating a minimal example but could not reproduce the bug in it. It must be something else, maybe a customized template/component. tnx anyway ;) Bruno On Wed, Jul 3, 2013 at 4:20 PM, Maurizio Cucchiara mcucchi...@apache.orgwrote: Hi Bruno, could you provide a code sample? Twitter :http://www.twitter.com/m_cucchiara G+ :https://plus.google.com/107903711540963855921 Linkedin:http://www.linkedin.com/in/mauriziocucchiara VisualizeMe: http://vizualize.me/maurizio.cucchiara?r=maurizio.cucchiara Maurizio Cucchiara On 3 July 2013 21:09, Bruno Klava bkl...@gmail.com wrote: Hi folks, after upgrading Struts from 2.3.14.3 to 2.3.15 my client side form validation stopped working. More specifically, the code to validate requiredstring is not being generated in the validateForm_xx() functions. Is anybody having the same issue? Tnx in advance, Bruno -- Bruno Klava -- Bruno Klava
Re: Possible client side validation bug in Struts 2.3.15
Hi Maurizio, is was generating a minimal example but could not reproduce the bug in it. It must be something else, maybe a customized template/component. tnx anyway ;) Bruno On Wed, Jul 3, 2013 at 4:20 PM, Maurizio Cucchiara mcucchi...@apache.orgwrote: Hi Bruno, could you provide a code sample? Twitter :http://www.twitter.com/m_cucchiara G+ :https://plus.google.com/107903711540963855921 Linkedin:http://www.linkedin.com/in/mauriziocucchiara VisualizeMe: http://vizualize.me/maurizio.cucchiara?r=maurizio.cucchiara Maurizio Cucchiara On 3 July 2013 21:09, Bruno Klava bkl...@gmail.com wrote: Hi folks, after upgrading Struts from 2.3.14.3 to 2.3.15 my client side form validation stopped working. More specifically, the code to validate requiredstring is not being generated in the validateForm_xx() functions. Is anybody having the same issue? Tnx in advance, Bruno -- Bruno Klava
Possible client side validation bug in Struts 2.3.15
Hi folks, after upgrading Struts from 2.3.14.3 to 2.3.15 my client side form validation stopped working. More specifically, the code to validate requiredstring is not being generated in the validateForm_xx() functions. Is anybody having the same issue? Tnx in advance, Bruno
Re: Possible client side validation bug in Struts 2.3.15
Hi Bruno, could you provide a code sample? Twitter :http://www.twitter.com/m_cucchiara G+ :https://plus.google.com/107903711540963855921 Linkedin:http://www.linkedin.com/in/mauriziocucchiara VisualizeMe: http://vizualize.me/maurizio.cucchiara?r=maurizio.cucchiara Maurizio Cucchiara On 3 July 2013 21:09, Bruno Klava bkl...@gmail.com wrote: Hi folks, after upgrading Struts from 2.3.14.3 to 2.3.15 my client side form validation stopped working. More specifically, the code to validate requiredstring is not being generated in the validateForm_xx() functions. Is anybody having the same issue? Tnx in advance, Bruno
Struts Validator Framework: client-side validation problem
I am trying to implement Client-Side Validations using struts 1.3 But server Side validations are working properly, but Client-Side Validations are not working properly. My code is as follows %@ taglib prefix=html uri=/WEB-INF/struts-html.tld % %@ taglib prefix=bean uri=/WEB-INF/struts-bean.tld % lt;!DOCTYPE HTML PUBLIC quot;-//W3C//DTD HTML 4.01 Transitional//ENquot;gt; html:html head meta http-equiv=Content-Type content=text/html; charset=UTF-8 titleLoginPage/title /head body center html:javascript formName=loginForm/ html:form action=/login.do onsubmit=return validateLoginForm(this) table trtdbean:message key=uname/ /td tdhtml:text property=uname//td tdhtml:errors property=uname/ /td/tr trtdbean:message key=upass/ /td tdhtml:password property=upass//td tdhtml:errors property=upass/ /td/tr /table html:submit value=Login / /html:form bremstrongClick here to nbsp; html:link href=SignUp.jspSignUp/html:link /strong/embr /center /body /html:html -- View this message in context: http://struts.1045723.n5.nabble.com/Struts-Validator-Framework-client-side-validation-problem-with-submitting-buttons-tp3481073p4761399.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Struts Validator Framework: client-side validation problem
What happens? What do you expect to happen? What's your validation config? We need something beyond it doesn't work. Dave On Sep 2, 2011 3:47 AM, RajasekharReddy pamired...@gmail.com wrote: I am trying to implement Client-Side Validations using struts 1.3 But server Side validations are working properly, but Client-Side Validations are not working properly. My code is as follows %@ taglib prefix=html uri=/WEB-INF/struts-html.tld % %@ taglib prefix=bean uri=/WEB-INF/struts-bean.tld % lt;!DOCTYPE HTML PUBLIC quot;-//W3C//DTD HTML 4.01 Transitional//ENquot;gt; html:html head meta http-equiv=Content-Type content=text/html; charset=UTF-8 titleLoginPage/title /head body center html:javascript formName=loginForm/ html:form action=/login.do onsubmit=return validateLoginForm(this) table trtdbean:message key=uname/ /td tdhtml:text property=uname//td tdhtml:errors property=uname/ /td/tr trtdbean:message key=upass/ /td tdhtml:password property=upass//td tdhtml:errors property=upass/ /td/tr /table html:submit value=Login / /html:form bremstrongClick here to nbsp; html:link href=SignUp.jspSignUp/html:link /strong/embr /center /body /html:html -- View this message in context: http://struts.1045723.n5.nabble.com/Struts-Validator-Framework-client-side-validation-problem-with-submitting-buttons-tp3481073p4761399.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Struts Validator Framework: client-side validation problem
I'm not familiar with the html:form tag; does that auto-include the script defining the validateForm() function? If not, I'd suggest a missing script in the html as a likely culprit ... at least, without any further info! Brian On Fri, Sep 2, 2011 at 5:47 AM, Dave Newton davelnew...@gmail.com wrote: What happens? What do you expect to happen? What's your validation config? We need something beyond it doesn't work. Dave On Sep 2, 2011 3:47 AM, RajasekharReddy pamired...@gmail.com wrote: I am trying to implement Client-Side Validations using struts 1.3 But server Side validations are working properly, but Client-Side Validations are not working properly. My code is as follows %@ taglib prefix=html uri=/WEB-INF/struts-html.tld % %@ taglib prefix=bean uri=/WEB-INF/struts-bean.tld % lt;!DOCTYPE HTML PUBLIC quot;-//W3C//DTD HTML 4.01 Transitional//ENquot;gt; html:html head meta http-equiv=Content-Type content=text/html; charset=UTF-8 titleLoginPage/title /head body center html:javascript formName=loginForm/ html:form action=/login.do onsubmit=return validateLoginForm(this) table trtdbean:message key=uname/ /td tdhtml:text property=uname//td tdhtml:errors property=uname/ /td/tr trtdbean:message key=upass/ /td tdhtml:password property=upass//td tdhtml:errors property=upass/ /td/tr /table html:submit value=Login / /html:form bremstrongClick here to nbsp; html:link href=SignUp.jspSignUp/html:link /strong/embr /center /body /html:html -- View this message in context: http://struts.1045723.n5.nabble.com/Struts-Validator-Framework-client-side-validation-problem-with-submitting-buttons-tp3481073p4761399.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
client side validation in struts2
in clValid.jsp, i had used input page %@ taglib prefix=s uri=/WEB-INF/struts-tags.tld % html head titleStrut2's actions/title s:head/ /head body center h1 Service Application/h1 br/ br/ s:form action=ClientValid validate=true namespace=/ s:textfield name=applName label=Applicant Name: / s:textfield name=charges label=Payable charges: / s:select label=Service Name: emptyOption=true list={'DrivingLicence','ElectricityBill', 'WaterBill','InsurancePremium'} name=service / s:submit align=center value=show client-Side validation/ /s:form /center /body /html in struts.xml package name=htcstruts extends=struts-default action name=ClientValid class=htcstruts.ClientValidAction result name=success /clResult.jsp /result result name=input /clValid.jsp /result /action action class is public class ClientValidAction extends ActionSupport { private String applName; private String service; private double charges; private String resStr; private ConcurrentHashMapString,Double services; public ClientValidAction() { services = new ConcurrentHashMapString,Double(); services.put(DrivingLicence,new Double(100.5)); services.put(ElectricityBill,new Double(40.5)); services.put(WaterBill,new Double(35.5)); services.put(InsurancePremium,new Double(30.5)); } public String execute() throws Exception { double cost = services.get(service); resStr = hello! +applName+ Charges for + service+ are +cost+.Please ready to pay; return SUCCESS; } public String getResStr() { return resStr; } public String getApplName() { return applName; } public void setApplName(String newName) { applName = newName; } public String getService() { return service; } public void setService(String newService) { service = newService; } public double getCharges() { return charges; } public void setCharges(double newCharge) { charges = newCharge; } } used a validator.xml ClientValidAction-validation.xml !DOCTYPE validators PUBLIC -//OpenSymphony Group//XWork Validator 1.0.2//EN http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd; validators field name=applName field-validator type=requiredstring true messageApplicant's name is required/message /field-validator /field field name=charges field-validator type=double 9.99 120.0 message Charges should be higher than ${minExclusive} and lessequal to ${maxInclusive} /message /field-validator /field /validators when i am asking the input , i am getting in browser FreeMarker template error! Method public java.util.List org.apache.struts2.components.Form.getValidators(java.lang.String) threw an exception when invoked on org.apache.struts2.components.Form@1be20c The problematic instruction: -- == list tag.getValidators(${tagName}) as validator [on line 46, column 9 in template/xhtml/form-close-validate.ftl] in include /${parameters.templateDir}/xhtml/form-close-validate.ftl [on line 25, column 1 in template/xhtml/form-close.ftl] -- Java backtrace for programmers: -- freemarker.template.TemplateModelException: Method public java.util.List org.apache.struts2.components.Form.getValidators(java.lang.String) threw an exception when invoked on org.apache.struts2.components.Form@1be20c at freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:130) at freemarker.core.MethodCall._getAsTemplateModel(MethodCall.java:93) at freemarker.core.Expression.getAsTemplateModel(Expression.java:89) at freemarker.core.IteratorBlock.accept(IteratorBlock.java:94) at freemarker.core.Environment.visit(Environment.java:210) at freemarker.core.IteratorBlock$Context.runLoop(IteratorBlock.java:167) at freemarker.core.Environment.visit(Environment.java:417) at freemarker.core.IteratorBlock.accept(IteratorBlock.java:102) at freemarker.core.Environment.visit(Environment.java:210) at freemarker.core.MixedContent.accept(MixedContent.java:92) at freemarker.core.Environment.visit(Environment.java:210) at freemarker.core.ConditionalBlock.accept(ConditionalBlock.java:79) at freemarker.core.Environment.visit(Environment.java:210) at freemarker.core.MixedContent.accept(MixedContent.java:92) at freemarker.core.Environment.visit(Environment.java:210) at freemarker.core.Environment.include(Environment.java:1483) at freemarker.core.Include.accept(Include.java:169) at freemarker.core.Environment.visit(Environment.java:210) at freemarker.core.MixedContent.accept(MixedContent.java:92) at freemarker.core.Environment.visit(Environment.java:210) at freemarker.core.Environment.process(Environment.java:190) at freemarker.template.Template.process(Template.java:237) at org.apache.struts2
Re: client side validation in struts2
Try changing %@ taglib prefix=s uri=/WEB-INF/struts-tags.tld % to %@ taglib prefix=s uri=/struts-tags % Chris On Tue, 2011-02-15 at 06:38 -0800, dasariprasad wrote: in clValid.jsp, i had used input page %@ taglib prefix=s uri=/WEB-INF/struts-tags.tld % html head titleStrut2's actions/title s:head/ /head body center h1 Service Application/h1 br/ br/ s:form action=ClientValid validate=true namespace=/ s:textfield name=applName label=Applicant Name: / s:textfield name=charges label=Payable charges: / s:select label=Service Name: emptyOption=true list={'DrivingLicence','ElectricityBill', 'WaterBill','InsurancePremium'} name=service / s:submit align=center value=show client-Side validation/ /s:form /center /body /html in struts.xml package name=htcstruts extends=struts-default action name=ClientValid class=htcstruts.ClientValidAction result name=success /clResult.jsp /result result name=input /clValid.jsp /result /action action class is public class ClientValidAction extends ActionSupport { private String applName; private String service; private double charges; private String resStr; private ConcurrentHashMapString,Double services; public ClientValidAction() { services = new ConcurrentHashMapString,Double(); services.put(DrivingLicence,new Double(100.5)); services.put(ElectricityBill,new Double(40.5)); services.put(WaterBill,new Double(35.5)); services.put(InsurancePremium,new Double(30.5)); } public String execute() throws Exception { double cost = services.get(service); resStr = hello! +applName+ Charges for + service+ are +cost+.Please ready to pay; return SUCCESS; } public String getResStr() { return resStr; } public String getApplName() { return applName; } public void setApplName(String newName) { applName = newName; } public String getService() { return service; } public void setService(String newService) { service = newService; } public double getCharges() { return charges; } public void setCharges(double newCharge) { charges = newCharge; } } used a validator.xml ClientValidAction-validation.xml !DOCTYPE validators PUBLIC -//OpenSymphony Group//XWork Validator 1.0.2//EN http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd; validators field name=applName field-validator type=requiredstring true messageApplicant's name is required/message /field-validator /field field name=charges field-validator type=double 9.99 120.0 message Charges should be higher than ${minExclusive} and lessequal to ${maxInclusive} /message /field-validator /field /validators when i am asking the input , i am getting in browser FreeMarker template error! Method public java.util.List org.apache.struts2.components.Form.getValidators(java.lang.String) threw an exception when invoked on org.apache.struts2.components.Form@1be20c The problematic instruction: -- == list tag.getValidators(${tagName}) as validator [on line 46, column 9 in template/xhtml/form-close-validate.ftl] in include /${parameters.templateDir}/xhtml/form-close-validate.ftl [on line 25, column 1 in template/xhtml/form-close.ftl] -- Java backtrace for programmers: -- freemarker.template.TemplateModelException: Method public java.util.List org.apache.struts2.components.Form.getValidators(java.lang.String) threw an exception when invoked on org.apache.struts2.components.Form@1be20c at freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:130) at freemarker.core.MethodCall._getAsTemplateModel(MethodCall.java:93) at freemarker.core.Expression.getAsTemplateModel(Expression.java:89) at freemarker.core.IteratorBlock.accept(IteratorBlock.java:94) at freemarker.core.Environment.visit(Environment.java:210) at freemarker.core.IteratorBlock$Context.runLoop(IteratorBlock.java:167) at freemarker.core.Environment.visit(Environment.java:417) at freemarker.core.IteratorBlock.accept(IteratorBlock.java:102) at freemarker.core.Environment.visit(Environment.java:210) at freemarker.core.MixedContent.accept(MixedContent.java:92) at freemarker.core.Environment.visit(Environment.java:210) at freemarker.core.ConditionalBlock.accept(ConditionalBlock.java:79) at freemarker.core.Environment.visit(Environment.java:210) at freemarker.core.MixedContent.accept(MixedContent.java:92) at freemarker.core.Environment.visit(Environment.java:210) at freemarker.core.Environment.include(Environment.java:1483) at freemarker.core.Include.accept(Include.java:169
controlling error message placement for client side validation
css_xhtml theme. Using server-side validation, the error message for field validation is placed above the input field. Using client side, the error message is shown below. I prefer the messages above. Is there a way to force the client-side validation to put the messages above the input field? Sample code below. s:set name=theme value='css_xhtml' scope=page / s:form action=address method=post validate=true name=loginform id=loginform div style=height: 20px;/div table border=0 cellpadding=0 cellspacing=0 tr td class=checkoutCellLeftFirst Name/td td class=checkoutCellRights:textfield name=firstname size=40 //td /tr /table s:submit value=submit / /s:form Mitch - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
client side validation does not appear to be working
hellos, i am using struts 2.1.2 with codebehind plugin ,i cant make client side validation working with validation annotations in my project though i have tried them succesfully in small examples. i am confused if i am hitting any issue in my configuration in project due to any other plugin. I am attaching my pom.xml and a small action class and a jsp thanks and regards Vineet project xmlns=http://maven.apache.org/POM/4.0.0; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd; modelVersion4.0.0/modelVersion groupIdaplomb.jobfinder/groupId artifactIdjobfinder/artifactId packagingpom/packaging version1.0-SNAPSHOT/version namejobfinder/name urlhttp://maven.apache.org/url repositories repository idibibilo/id nameJava hibernate Repository for Maven 2/name urlhttp://www.ibiblio.org/maven/url layoutdefault/layout /repository repository idMaven Plugin Repository/id urlhttp://struts2plugin-maven-repo.googlecode.com/svn/trunk//url snapshots enabledfalse/enabled /snapshots releases enabledtrue/enabled /releases /repository repository idmvnrepository.com/id nameJava hibernate Repository for Maven 2/name urlhttp://mvnrepository.com//url layoutdefault/layout /repository repository idjava.net repo/id namejta download/name urlhttp://download.java.net/maven/2/url layoutdefault/layout /repository repository idstruts2.1.2-staging/id nameStruts 2.1.2 staging repository/name layoutdefault/layout urlhttp://people.apache.org/builds/struts/2.1.2/m2-staging-repository//url snapshots enabledfalse/enabled /snapshots /repository /repositories reporting plugins plugin groupIdorg.apache.maven.plugins/groupId artifactIdmaven-compiler-plugin/artifactId configuration source1.6/source target1.6/target /configuration /plugin plugin groupIdorg.apache.maven.plugins/groupId artifactIdmaven-surefire-report-plugin/artifactId version2.4.2/version /plugin /plugins /reporting build plugins plugin groupIdorg.apache.maven.plugins/groupId artifactIdmaven-surefire-plugin/artifactId version2.4.2/version configuration suiteXmlFiles suiteXmlFilesrc/test/resources/testng.xml/suiteXmlFile /suiteXmlFiles /configuration /plugin /plugins /build dependencies dependency groupIdlog4j/groupId artifactIdlog4j/artifactId version1.2.12/version scopetest/scope /dependency dependency groupIdorg.slf4j/groupId artifactIdslf4j-log4j12/artifactId version1.4.2/version /dependency dependency groupIdorg.testng/groupId artifactIdtestng/artifactId version5.8/version scopetest/scope classifierjdk15/classifier /dependency dependency groupIdmysql/groupId artifactIdmysql-connector-java/artifactId version5.0.5/version scopetest/scope /dependency dependency groupIdorg.hibernate/groupId artifactIdhibernate/artifactId version3.3.1.GA/version exclusions exclusion groupIdasm/groupId artifactIdasm/artifactId /exclusion exclusion groupIdasm/groupId artifactIdasm-attrs/artifactId /exclusion exclusion groupIdcglib/groupId artifactIdcglib/artifactId /exclusion /exclusions /dependency dependency groupIdasm/groupId artifactIdasm/artifactId version2.2.3/version /dependency dependency groupIdjavassist/groupId artifactIdjavassist/artifactId version3.8.0.GA/version /dependency dependency groupIdcglib/groupId artifactIdcglib-nodep/artifactId version2.1_3/version /dependency dependency groupIdorg.hibernate/groupId artifactIdhibernate-annotations/artifactId version3.4.0.GA/version /dependency dependency groupIdorg.springframework/groupId artifactIdspring/artifactId version2.5.5/version /dependency dependency groupIdorg.springframework/groupId artifactIdspring-aspects/artifactId version2.5.5/version /dependency dependency groupIdopensymphony/groupId artifactIdognl/artifactId version2.6.11/version /dependency dependency groupIdorg.apache.struts/groupId artifactIdstruts2-dojo-plugin/artifactId version2.1.2/version /dependency dependency groupIdorg.apache.struts/groupId artifactIdstruts2-core
Client Side Validation Not Working
Guys, I don't know what I am doing wrong. I am missing the actual validation JavaScript code in the generated html when accessing add_comment.do?blogid=23. I have included the snippet below. addcomment.jsp s:form action=save_comment method=POST validate=true s:actionerror / s:actionmessage / input type=hidden id=blogid name=comment.blogid value=s:property value=blog.id s:textfield required=true id=name name=comment.name label=Name/ s:textarea required=true id=comment name=comment.comment label=Comment/ s:submit/ struts.xml action name=add_comment class=CommentAction method=add result/blog/addcomment.jsp/result /action action name=save_comment class=CommentAction method=save result name=input/blog/addcomment.jsp/result result/blog/addcomment.jsp/result /action CommentAction-save-validation.xml validators field name=comment.name field-validator type=requiredstring param name=trimtrue/param messageName is required/message /field-validator /field field name=comment.comment field-validator type=requiredstring param name=trimtrue/param messageComment is required/message /field-validator /field /validators Generated html by browser when accessing add_comment.do?blogid=23 form namespace=/blog id=save_comment name=save_comment onsubmit=return validateForm_save_comment(); action=/blog/save_comment.action method=POST ... ... ... function validateForm_save_comment() { form = document.getElementById(save_comment); clearErrorMessages(form); clearErrorLabels(form); var errors = false; // Missing actual validation here.. return !errors; } I would really appreciate is anyone has idea what am I doing wrong. Thanks Rabin
Re: Client Side Validation Not Working
And the server-side validation is working? I think not, name of xml is not as it should be - it should be CommentAction-save_comment-validation.xml Regards -- Lukasz http://www.lenart.org.pl/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Client Side Validation Not Working
Lukasz, Thanks a lot. I changed the action name and then what a silly mistake... Rabin -Original Message- From: Lukasz Lenart [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 18, 2008 10:31 AM To: Struts Users Mailing List Subject: Re: Client Side Validation Not Working And the server-side validation is working? I think not, name of xml is not as it should be - it should be CommentAction-save_comment-validation.xml Regards -- Lukasz http://www.lenart.org.pl/ - 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]
Re: Struts 2.1.2 client side validation doesn't get generated
Anyone? The server side validation works fine, when I post the form it comes back with the correct validation but the client side is not being generated because the performValidation is being set to false. The obvious work around is to edit the form-close-validate.ftl and remove (parameters.performValidation?default(false) == true), but why does this performValidation there? Especially since the form-validate doesn't make the same check and generates the return function. -- View this message in context: http://www.nabble.com/Struts-2.1.2-client-side-validation-doesn%27t-get-generated-tp20221161p20240335.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts 2.1.2 client side validation doesn't get generated
It looks like this is a Google Guice issue. When I swapped the guice plugin for the spring plugin everything worked as expected. -- View this message in context: http://www.nabble.com/Struts-2.1.2-client-side-validation-doesn%27t-get-generated-tp20221161p20240986.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Struts 2.1.2 client side validation doesn't get generated
I'm trying to get struts to spit out the client side validation code and it doesn't seem to be working. The backend validation is working fine but when I use the xhtml theme with the s:head /, the script code under the form is not being generated. Looking at the code it looks like it's failing this check parameters.performValidation?default(false) == true in the form-close-validate.ftl file. What would cause the performValidation not to be set as true? I'm using annotations to markup my action. public class TestAction extends ActionSupport { private String username, email, password, password2; @Override public String execute() { return SUCCESS; } public String save() { // Do stuff and return SUCCESS ... } @RequiredStringValidator(message = Required Field., key = validation.required) @EmailValidator(message = Enter a valid email., key = validation.email) public String getEmail() { return email; } @RequiredStringValidator(message = Required Field., key = validation.required) @StringLengthFieldValidator(trim = true, minLength = 3 , maxLength = 16, message = Must be between ${minLength} and ${maxLength}., key = validation.length) public String getPassword() { return password; } @FieldExpressionValidator(expression = password2.equals(password), message = Passwords do not match., key = validation.match.passwords) @RequiredStringValidator(message = Required Field., key = validation.required) public String getPassword2() { return password2; } @RequiredStringValidator(message = Required Field., key = validation.required) @StringLengthFieldValidator(trim = true, minLength = 3 , maxLength = 16, message = Must be between ${minLength} and ${maxLength}., key = validation.length) public String getUsername() { return username; } public void setEmail(final String email) { this.email = email; } public void setPassword(final String password) { this.password = password; } public void setPassword2(final String password2) { this.password2 = password2; } public void setUsername(final String username) { this.username = username; } } here is my form code: s:form label=Test Form id=save3 action=save namespace=/install validate=true theme=xhtml cssClass=form-large s:textfield key=username required=true theme=xhtml / s:textfield key=email required=true theme=xhtml / s:password key=password required=true theme=xhtml / s:password key=password2 required=true theme=xhtml/ s:submit key=save theme=xhtml / /s:form struts.xml !-- Constant Settings -- constant name=struts.enable.DynamicMethodInvocation value=false / constant name=struts.codebehind.pathPrefix value=/WEB-INF/pages// constant name=struts.url.includeParams value=none / constant name=struts.custom.i18n.resources value=global-messages / constant name=struts.objectFactory value=guice / constant name=guice.module value=test.util.ConfigurationModule / !-- Development Settings Change these when going to production -- constant name=struts.devMode value=true / constant name=struts.i18n.reload value=true / constant name=struts.configuration.xml.reload value=true / package name=test namespace=/install extends=struts-default action name=index class=test.action.TestAction result/WEB-INF/pages/index.jsp/result /action action name=save class=test.action.TestAction method=save result name=success/WEB-INF/pages/success.jsp/result result name=input/WEB-INF/pages/index.jsp/result result name=error/WEB-INF/pages/error/default.jsp/result /action /package -- View this message in context: http://www.nabble.com/Struts-2.1.2-client-side-validation-doesn%27t-get-generated-tp20221161p20221161.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [S2] client-side validation error message duplication
If you are using Spring into your projet, this may be related to the beans being singletons, we had this problem in the past, we actually were required to call cleanErrorsAndMessages method at each prepare call. - Pascal Kawczynski, David wrote: I'm using struts 2.1.2, and the xhtml theme to render a form. When client-side validaiton fails, an error message is placed above the bad input fields. Subsequent submission attempts result in new error messages being ADDED to the UI, but the old messages are never removed. I need to clear out previous submission attempt's error messages before adding current submission attempt's error messages. I appreciate any help you can provide! -dave Notice: This e-mail message, together with any attachments, contains information of Merck Co., Inc. (One Merck Drive, Whitehouse Station, New Jersey, USA 08889), and/or its affiliates (which may be known outside the United States as Merck Frosst, Merck Sharp Dohme or MSD and in Japan, as Banyu - direct contact information for affiliates is available at http://www.merck.com/contact/contacts.html) that may be confidential, proprietary copyrighted and/or legally privileged. It is intended solely for the use of the individual or entity named on this message. If you are not the intended recipient, and have received this message in error, please notify us immediately by reply e-mail and then delete it from your system. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [S2] client-side validation error message duplication
--- On Fri, 9/12/08, Kawczynski, David wrote: I'm using struts 2.1.2, and the xhtml theme to render a form. When client-side validaiton fails, an error message is placed above the bad input fields. Subsequent submission attempts result in new error messages being ADDED to the UI, but the old messages are never removed. I found the issue. I was being a dodo. The struts/xhtml/validation.js file's clearErrorMessages function contains code to retrieve the table that stores the form. It then iterates over the table's rows, deleting any that has an errorFor attribute. In my case, the table that is retrieved is completely empty! It turns out that my jsp file looks like this: s:form action=save table s:textfield blah blah blah/ /table /s:form Which resulted in the generated html to look like this: s:form action=save table class=wwFormTable table tr td blah blah blah/td /tr /table /table /s:form The first table in the form had no rows! Removing the empty table elements from the jsp page fixed my issue. I should pay more attention when migrating from the simple theme to an xhtml theme. :) Notice: This e-mail message, together with any attachments, contains information of Merck Co., Inc. (One Merck Drive, Whitehouse Station, New Jersey, USA 08889), and/or its affiliates (which may be known outside the United States as Merck Frosst, Merck Sharp Dohme or MSD and in Japan, as Banyu - direct contact information for affiliates is available at http://www.merck.com/contact/contacts.html) that may be confidential, proprietary copyrighted and/or legally privileged. It is intended solely for the use of the individual or entity named on this message. If you are not the intended recipient, and have received this message in error, please notify us immediately by reply e-mail and then delete it from your system. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Datetimepicker and client-side validation
There is no client side date validator in the default themes. I added a basic one in the xhtml theme for use with the datetimepicker; it has a hardcoded date format though (dd/MM/). To add it, open your xhtml theme's form-close-validate.ftl file, and as the last option add the following lines: #elseif validator.validatorType = date if (continueValidation field.value != null field.value != field.value.replace(/^\s+|\s+$/g,).length != 0) { var datePicker = dojo.widget.byId(field.parentNode.id); var value = datePicker.getDate(); #if validator.min?exists var minValue = dojo.date.parse(${validator.min?date}, {datePattern: 'dd/MM/'}); #else var minValue = null; /#if #if validator.max?exists var maxValue = dojo.date.parse(${validator.max?date}, {datePattern: 'dd/MM/'});; #else var maxValue = null; /#if if ((minValue != null value minValue) || (maxValue != null value maxValue)) { addError(field, error); errors = true; #if validator.shortCircuitcontinueValidation = false;/#if } } /#if 2008/9/11 Kawczynski, David [EMAIL PROTECTED]: I am using the datetimepicker on a form with client-side validation enabled. Form submissions with a blank datetime field should result in validation being run against that field. This is not the case -- this field is only validated on the server. No other form field uses the dojo, and they are all validated on the client-sided correctly. What do I have to do so the datetimepicker field receives client-sided validation like the other fields? (I'm using struts 2.1.2 with xwork 2.1.1) Thanks in advance, -dave === === ==THE struts.xml: !DOCTYPE struts PUBLIC -//Apache Software Foundation//DTD Struts Configuration 2.0//EN http://struts.apache.org/dtds/struts-2.0.dtd; struts include file=struts-default.xml/ constant name=struts.action.extension value=action / constant name=struts.devMode value=true / constant name=struts.multipart.maxSize value=2097152 / constant name=struts.configuration.xml.reload value=true / package name=siterequest namespace=/admin/siterequest extends=struts-default default-interceptor-ref name=defaultStack/ action name=save method=save class=siterequest.SiteRequestAction result/admin/siterequest/request_form_thanks.jsp/result result name=input/admin/siterequest/request_form.jsp/result result name=failure/admin/siterequest/request_form.jsp/result /action /package /struts === === ==THE SiteRequestAction-save-validation.xml: ?xml version=1.0 encoding=UTF-8? !DOCTYPE validators PUBLIC -//OpenSymphony Group//XWork Validator 1.0.2//EN http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd; validators field name=siteRequest.isid field-validator type=requiredstring param name=trimtrue/param messageSubmitter ISID is required/message /field-validator field-validator type=stringlength param name=maxLength8/param messageSubmitter ISID must be 8 characters or less/message /field-validator /field field name=siteRequest.businessArea field-validator type=requiredstring param name=trimtrue/param messageBusiness Area is required/message /field-validator /field field name=siteRequest.projectTitle field-validator type=requiredstring param name=trimtrue/param messageProject Title is required/message /field-validator field-validator type=stringlength param name=maxLength200/param messageProject Title must be 200 characters or less/message /field-validator /field field name=siteRequest.description field-validator type=requiredstring param name=trimtrue/param messageDescription is required/message /field-validator field-validator type=stringlength param name=maxLength2000/param messageDescription must be 2000 characters or less/message /field-validator /field field name=siteRequest.siteName field-validator type=requiredstring param name=trimtrue/param messageSite Name is required/message /field-validator field-validator type=stringlength param name=maxLength200/param messageSite Name must be 200 characters or less/message /field-validator /field field name=siteRequest.issueType field-validator type
Datetimepicker and client-side validation
I am using the datetimepicker on a form with client-side validation enabled. Form submissions with a blank datetime field should result in validation being run against that field. This is not the case -- this field is only validated on the server. No other form field uses the dojo, and they are all validated on the client-sided correctly. What do I have to do so the datetimepicker field receives client-sided validation like the other fields? (I'm using struts 2.1.2 with xwork 2.1.1) Thanks in advance, -dave === === ==THE struts.xml: !DOCTYPE struts PUBLIC -//Apache Software Foundation//DTD Struts Configuration 2.0//EN http://struts.apache.org/dtds/struts-2.0.dtd; struts include file=struts-default.xml/ constant name=struts.action.extension value=action / constant name=struts.devMode value=true / constant name=struts.multipart.maxSize value=2097152 / constant name=struts.configuration.xml.reload value=true / package name=siterequest namespace=/admin/siterequest extends=struts-default default-interceptor-ref name=defaultStack/ action name=save method=save class=siterequest.SiteRequestAction result/admin/siterequest/request_form_thanks.jsp/result result name=input/admin/siterequest/request_form.jsp/result result name=failure/admin/siterequest/request_form.jsp/result /action /package /struts === === ==THE SiteRequestAction-save-validation.xml: ?xml version=1.0 encoding=UTF-8? !DOCTYPE validators PUBLIC -//OpenSymphony Group//XWork Validator 1.0.2//EN http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd; validators field name=siteRequest.isid field-validator type=requiredstring param name=trimtrue/param messageSubmitter ISID is required/message /field-validator field-validator type=stringlength param name=maxLength8/param messageSubmitter ISID must be 8 characters or less/message /field-validator /field field name=siteRequest.businessArea field-validator type=requiredstring param name=trimtrue/param messageBusiness Area is required/message /field-validator /field field name=siteRequest.projectTitle field-validator type=requiredstring param name=trimtrue/param messageProject Title is required/message /field-validator field-validator type=stringlength param name=maxLength200/param messageProject Title must be 200 characters or less/message /field-validator /field field name=siteRequest.description field-validator type=requiredstring param name=trimtrue/param messageDescription is required/message /field-validator field-validator type=stringlength param name=maxLength2000/param messageDescription must be 2000 characters or less/message /field-validator /field field name=siteRequest.siteName field-validator type=requiredstring param name=trimtrue/param messageSite Name is required/message /field-validator field-validator type=stringlength param name=maxLength200/param messageSite Name must be 200 characters or less/message /field-validator /field field name=siteRequest.issueType field-validator type=requiredstring param name=trimtrue/param messageIssue Type is required/message /field-validator /field field name=siteRequest.releaseDate field-validator type=required messageDesired Release Date is required./message /field-validator field-validator type=date param name=min08/01/2008/param param name=max01/01/2030/param messageInvalid Desired Release Date/message /field-validator /field /validators === === ==THE jsp page: %@ taglib prefix=s uri=/struts-tags % %@ taglib prefix=sx uri=/struts-dojo-tags % !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN html head titleChange Request Submission Form/title sx:head/ s:head/ link rel=stylesheet href=/admin/css/site-request.css type=text/css / /head body div id=content h1Change Request Submission Form/h1 pPlease complete the form below to submit a request to the Global Solutions Delivery group. You will receive a response within 2 business days./p pItems marked with an asterisk (span class=required*/span) are required./p s:form action=save namespace=/admin/siterequest name=requestform method=post enctype=multipart/form-data theme=xhtml
Re: Struts Validator Framework: client-side validation problem with submitting buttons
Thank you very much. Laurie Harper wrote: I did what I should have done in the first place and looked it up: Form.submit() is specified to *not* call the onsubmit handler, so this is the correct behaviour (and should be consistent across all browsers). When in doubt, check the documentation :-) L. cacodemon79 wrote: Bingo! Now it works! Thanks a lot. However i can't understand why the onsubmit handler is not triggered by the submit() function! Laurie Harper wrote: Did you confirm whether calling the form's submit() method triggers its onsubmit handler? It may be that calling submit() bypasses it, in which case an explicit guard in your submit function might do the trick: function submitRegistrazioneUtenteForm(nomeForm){ var form = ...; if (validateRegistrazioneUtenteForm(form)) { form.submit(); } return false; } L. cacodemon79 wrote: No suggestions? :( I also tried to use document.registrazioneUtenteForm.submit()) instead of eval(document.+nomeForm+.submit()) but the result is the same. The form is submitted but I can't see any javascript alerts. I can't understand where is the problem. I hope you can help me. Thanks. cacodemon79 wrote: Hi, I'm using Struts Validator Framework (Struts 1.3). Server-side validation works well. The problem is in client-side validation. The form name I have to validate is: RegistrazioneUtenteForm. In my jsp page I have 2 buttons: 1) html:link href=javascript:submitRegistrazioneUtenteForm('registrazioneUtenteForm')bean:message key='form.submit'//html:link 2) html:submit / and the following form declaration: html:form action=/registrazioneUtente method=post focus=username onsubmit=return validateRegistrazioneUtenteForm(this) Moreover I have enabled javascript validation: html:javascript formName=registrazioneUtenteForm cdata=false / The javascript function submitRegistrazioneUtenteForm is the following: function submitRegistrazioneUtenteForm(nomeForm){ eval(document.+nomeForm+.submit()); } If I click on the second button (html:submit), all works well (I get javascript alerts). If I click on the first button (html:link), the form is submitted but I can't see any javascript alerts. I can't understand where is the problem. Can you help me? Thanks in advance. - 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] -- View this message in context: http://www.nabble.com/Struts-Validator-Framework%3A-client-side-validation-problem-with-submitting-buttons-tp18042962p18093853.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts Validator Framework: client-side validation problem with submitting buttons
No suggestions? :( I also tried to use document.registrazioneUtenteForm.submit()) instead of eval(document.+nomeForm+.submit()) but the result is the same. The form is submitted but I can't see any javascript alerts. I can't understand where is the problem. I hope you can help me. Thanks. cacodemon79 wrote: Hi, I'm using Struts Validator Framework (Struts 1.3). Server-side validation works well. The problem is in client-side validation. The form name I have to validate is: RegistrazioneUtenteForm. In my jsp page I have 2 buttons: 1) html:link href=javascript:submitRegistrazioneUtenteForm('registrazioneUtenteForm')bean:message key='form.submit'//html:link 2) html:submit / and the following form declaration: html:form action=/registrazioneUtente method=post focus=username onsubmit=return validateRegistrazioneUtenteForm(this) Moreover I have enabled javascript validation: html:javascript formName=registrazioneUtenteForm cdata=false / The javascript function submitRegistrazioneUtenteForm is the following: function submitRegistrazioneUtenteForm(nomeForm){ eval(document.+nomeForm+.submit()); } If I click on the second button (html:submit), all works well (I get javascript alerts). If I click on the first button (html:link), the form is submitted but I can't see any javascript alerts. I can't understand where is the problem. Can you help me? Thanks in advance. -- View this message in context: http://www.nabble.com/Struts-Validator-Framework%3A-client-side-validation-problem-with-submitting-buttons-tp18042962p18072574.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts Validator Framework: client-side validation problem with submitting buttons
Hi, Maybe you should install Firebug for Firefox (not working with 3.0) and debug the JavaScript? Regards -- Lukasz http://www.lenart.org.pl/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [struts] Struts Validator Framework: client-side validation problem with submitting buttons
Lukasz Lenart wrote: Maybe you should install Firebug for Firefox (not working with 3.0) and debug the JavaScript? A beta version of firebug does work with 3.0 : http://getfirebug.com/releases/index.html -Dale - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [struts] Struts Validator Framework: client-side validation problem with submitting buttons
A beta version of firebug does work with 3.0 : http://getfirebug.com/releases/index.html Thanks! -- Lukasz http://www.lenart.org.pl/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts Validator Framework: client-side validation problem with submitting buttons
Did you confirm whether calling the form's submit() method triggers its onsubmit handler? It may be that calling submit() bypasses it, in which case an explicit guard in your submit function might do the trick: function submitRegistrazioneUtenteForm(nomeForm){ var form = ...; if (validateRegistrazioneUtenteForm(form)) { form.submit(); } return false; } L. cacodemon79 wrote: No suggestions? :( I also tried to use document.registrazioneUtenteForm.submit()) instead of eval(document.+nomeForm+.submit()) but the result is the same. The form is submitted but I can't see any javascript alerts. I can't understand where is the problem. I hope you can help me. Thanks. cacodemon79 wrote: Hi, I'm using Struts Validator Framework (Struts 1.3). Server-side validation works well. The problem is in client-side validation. The form name I have to validate is: RegistrazioneUtenteForm. In my jsp page I have 2 buttons: 1) html:link href=javascript:submitRegistrazioneUtenteForm('registrazioneUtenteForm')bean:message key='form.submit'//html:link 2) html:submit / and the following form declaration: html:form action=/registrazioneUtente method=post focus=username onsubmit=return validateRegistrazioneUtenteForm(this) Moreover I have enabled javascript validation: html:javascript formName=registrazioneUtenteForm cdata=false / The javascript function submitRegistrazioneUtenteForm is the following: function submitRegistrazioneUtenteForm(nomeForm){ eval(document.+nomeForm+.submit()); } If I click on the second button (html:submit), all works well (I get javascript alerts). If I click on the first button (html:link), the form is submitted but I can't see any javascript alerts. I can't understand where is the problem. Can you help me? Thanks in advance. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts Validator Framework: client-side validation problem with submitting buttons
Bingo! Now it works! Thanks a lot. However i can't understand why the onsubmit handler is not triggered by the submit() function! Laurie Harper wrote: Did you confirm whether calling the form's submit() method triggers its onsubmit handler? It may be that calling submit() bypasses it, in which case an explicit guard in your submit function might do the trick: function submitRegistrazioneUtenteForm(nomeForm){ var form = ...; if (validateRegistrazioneUtenteForm(form)) { form.submit(); } return false; } L. cacodemon79 wrote: No suggestions? :( I also tried to use document.registrazioneUtenteForm.submit()) instead of eval(document.+nomeForm+.submit()) but the result is the same. The form is submitted but I can't see any javascript alerts. I can't understand where is the problem. I hope you can help me. Thanks. cacodemon79 wrote: Hi, I'm using Struts Validator Framework (Struts 1.3). Server-side validation works well. The problem is in client-side validation. The form name I have to validate is: RegistrazioneUtenteForm. In my jsp page I have 2 buttons: 1) html:link href=javascript:submitRegistrazioneUtenteForm('registrazioneUtenteForm')bean:message key='form.submit'//html:link 2) html:submit / and the following form declaration: html:form action=/registrazioneUtente method=post focus=username onsubmit=return validateRegistrazioneUtenteForm(this) Moreover I have enabled javascript validation: html:javascript formName=registrazioneUtenteForm cdata=false / The javascript function submitRegistrazioneUtenteForm is the following: function submitRegistrazioneUtenteForm(nomeForm){ eval(document.+nomeForm+.submit()); } If I click on the second button (html:submit), all works well (I get javascript alerts). If I click on the first button (html:link), the form is submitted but I can't see any javascript alerts. I can't understand where is the problem. Can you help me? Thanks in advance. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/Struts-Validator-Framework%3A-client-side-validation-problem-with-submitting-buttons-tp18042962p18075348.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts Validator Framework: client-side validation problem with submitting buttons
Hi, 2008/6/23 cacodemon79 [EMAIL PROTECTED]: Bingo! Now it works! Thanks a lot. However i can't understand why the onsubmit handler is not triggered by the submit() function! Maybe it depends on Web Browser, did you try with others? Regards -- Lukasz http://www.lenart.org.pl/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts Validator Framework: client-side validation problem with submitting buttons
I did what I should have done in the first place and looked it up: Form.submit() is specified to *not* call the onsubmit handler, so this is the correct behaviour (and should be consistent across all browsers). When in doubt, check the documentation :-) L. cacodemon79 wrote: Bingo! Now it works! Thanks a lot. However i can't understand why the onsubmit handler is not triggered by the submit() function! Laurie Harper wrote: Did you confirm whether calling the form's submit() method triggers its onsubmit handler? It may be that calling submit() bypasses it, in which case an explicit guard in your submit function might do the trick: function submitRegistrazioneUtenteForm(nomeForm){ var form = ...; if (validateRegistrazioneUtenteForm(form)) { form.submit(); } return false; } L. cacodemon79 wrote: No suggestions? :( I also tried to use document.registrazioneUtenteForm.submit()) instead of eval(document.+nomeForm+.submit()) but the result is the same. The form is submitted but I can't see any javascript alerts. I can't understand where is the problem. I hope you can help me. Thanks. cacodemon79 wrote: Hi, I'm using Struts Validator Framework (Struts 1.3). Server-side validation works well. The problem is in client-side validation. The form name I have to validate is: RegistrazioneUtenteForm. In my jsp page I have 2 buttons: 1) html:link href=javascript:submitRegistrazioneUtenteForm('registrazioneUtenteForm')bean:message key='form.submit'//html:link 2) html:submit / and the following form declaration: html:form action=/registrazioneUtente method=post focus=username onsubmit=return validateRegistrazioneUtenteForm(this) Moreover I have enabled javascript validation: html:javascript formName=registrazioneUtenteForm cdata=false / The javascript function submitRegistrazioneUtenteForm is the following: function submitRegistrazioneUtenteForm(nomeForm){ eval(document.+nomeForm+.submit()); } If I click on the second button (html:submit), all works well (I get javascript alerts). If I click on the first button (html:link), the form is submitted but I can't see any javascript alerts. I can't understand where is the problem. Can you help me? Thanks in advance. - 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]
Struts Validator Framework: client-side validation problem with submitting buttons
Hi, I'm using Struts Validator Framework (Struts 1.3). Server-side validation works well. The problem is in client-side validation. The form name I have to validate is: RegistrazioneUtenteForm. In my jsp page I have 2 buttons: 1) html:link href=javascript:submitRegistrazioneUtenteForm('registrazioneUtenteForm')bean:message key='form.submit'//html:link 2) html:submit / and the following form declaration: html:form action=/registrazioneUtente method=post focus=username onsubmit=return validateRegistrazioneUtenteForm(this) Moreover I have enabled javascript validation: html:javascript formName=registrazioneUtenteForm cdata=false / The javascript function submitRegistrazioneUtenteForm is the following: function submitRegistrazioneUtenteForm(nomeForm){ eval(document.+nomeForm+.submit()); } If I click on the second button (html:submit), all works well (I get javascript alerts). If I click on the first button (html:link), the form is submitted but I can't see any javascript alerts. I can't understand where is the problem. Can you help me? Thanks in advance. -- View this message in context: http://www.nabble.com/Struts-Validator-Framework%3A-client-side-validation-problem-with-submitting-buttons-tp18042962p18042962.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Struts 2.0: Ajax based client side validation onblur
For Struts 2.0 (NOT 2.1): The documentation for introduction to http://struts.apache.org/2.0.11.1/docs/ajax-client-side-validation.html Ajax Client Side Validation says that The validation occurs on each onblur event for each form element. The http://struts.apache.org/2.0.11.1/docs/ajax-validation.html example starts off by saying that An example is provided on how to use AJAX validation with Prototype, in this case the Dojo plugin is not required. So I scroll down to the bottom of the page and try to follow the Example using Prototype. However, there are two issues I see with this example. Firstly, there is no onblur specified for each element. So does this example really work for onblur? Secondly, even if I assume that the code for onblur will be put at runtime, when implementing the said example, my browser tells me that it could not find Ajax which is probably an object in prototype.js. Apparently the src in the two script declarations: 1) script language=JavaScript src=${pageContext.request.contextPath}/struts/utils.js type=text/javascript/script AND 2) script src=${pageContext.request.contextPath}/js/prototype.js type=text/javascript/script cannot be resolved. From all my searching, there has been no clue as to where I can find these .js files. People say that they are automagically put there. But even for that magic to happen, those files must be present in the source code of struts. I searched through the entire source code and it just does not have either of those two files. To conclude, I am trying to get Ajax based client side validation to work onblur at each element (NOT onsubmit of the form; that works fine). But there seems to be no example - not even in the showcase tutorial. If anyone has got it to work, I would really appreciate if you could share your example with me. Thanks. PS: In many places in the documentation I see notifications to the effect: This documentation refers to version 2.1 which has not been released yet. Isn't that kind of ridiculous? Providing documentation for something that isn't even released is something I cannot wrap my head around. If someone can explain that concept to a novice user like myself, it would be a great help. -- View this message in context: http://www.nabble.com/Struts-2.0%3A-Ajax-based-client-side-validation-%22onblur%22-tp16608849p16608849.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Client Side Validation with Struts
Hello. I am using Struts 1.3.8. The issue is not one of making the Javascript work (it is working correctly), but rather preventing a Struts action from being called. Is this possible given that the action of a form is a Struts action? I'm not sure if I understand you, but all you have to do is return true or false from your JavaScript function (as you doing), and that will prevent a web browser to submit form and send them to a www server. And if there be no request from web browser, there be no action called. Please copy/paste the web page content you had got when you started your form. Regards -- Lukasz http://www.linkedin.com/in/lukaszlenart - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Client Side Validation with Struts
Hi, Could you be more specific, which Struts version? If you use onsubmit event, you should do that like this: onsubmit=JavaScript: return validate(); where validate() has to return true or false. Regards -- Lukasz http://www.linkedin.com/in/lukaszlenart - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Client Side Validation with Struts
Hello. I am using Struts 1.3.8. The issue is not one of making the Javascript work (it is working correctly), but rather preventing a Struts action from being called. Is this possible given that the action of a form is a Struts action? - Asad On Sat, Mar 29, 2008 at 6:44 AM, Lukasz Lenart [EMAIL PROTECTED] wrote: Hi, Could you be more specific, which Struts version? If you use onsubmit event, you should do that like this: onsubmit=JavaScript: return validate(); where validate() has to return true or false. Regards -- Lukasz http://www.linkedin.com/in/lukaszlenart - 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]
Client Side Validation with Struts
Hello. I am validating data on the client-side using the Javascript onsubmit event handler and this is working just fine. The problem I am having is with trying to prevent the action from being called after the alert window is closed. Is it possible to do this? If so, how? Also, for client side validation with Struts, do I need to use the validator? Any help would be appreciated. Thank you. - Asad - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
How to enable the client side validation?
Hi all, just as title Thanks. Talos
Re: How to enable the client side validation?
http://struts.apache.org/2.x/docs/client-side-validation.html Nils-H On Wed, Mar 26, 2008 at 9:34 AM, Chen Chunwei [EMAIL PROTECTED] wrote: Hi all, just as title Thanks. Talos - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to enable the client side validation?
My struts version is 1.1. And I tried to add html:javascript formName=submitForm / in my jsp file which needs validation. But it seems not working. Talos - Original Message - From: Nils-Helge Garli Hegvik [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Wednesday, March 26, 2008 4:39 PM Subject: Re: How to enable the client side validation? http://struts.apache.org/2.x/docs/client-side-validation.html Nils-H On Wed, Mar 26, 2008 at 9:34 AM, Chen Chunwei [EMAIL PROTECTED] wrote: Hi all, just as title Thanks. Talos - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to enable the client side validation?
Thanks Antonio As I said, I've already used html:javascript. Of course, I've alse done the other stuff found in the document you refer to (offline version). But it does not work. Can you give some more details of using client-side validation? Talos - Original Message - From: Antonio Petrelli [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Wednesday, March 26, 2008 4:56 PM Subject: Re: How to enable the client side validation? 2008/3/26, Chen Chunwei [EMAIL PROTECTED]: My struts version is 1.1. And I tried to add html:javascript formName=submitForm / in my jsp file which needs validation. But it seems not working. See: http://struts.apache.org/1.1/userGuide/building_view.html#validator Antonio
Re: How to enable the client side validation?
Well, the case is that the Javascript code was generated well, but it was not triggered. Talos - Original Message - From: Antonio Petrelli [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Wednesday, March 26, 2008 5:10 PM Subject: Re: How to enable the client side validation? 2008/3/26, Chen Chunwei [EMAIL PROTECTED]: As I said, I've already used html:javascript. Of course, I've alse done the other stuff found in the document you refer to (offline version). But it does not work. What exactly does not work? Give more details, for example, exceptions at startup of the application, or the Javascript code is not generated, etc. Antonio
Re: How to enable the client side validation?
2008/3/26, Chen Chunwei [EMAIL PROTECTED]: Well, the case is that the Javascript code was generated well, but it was not triggered. Well, that's strange. Can you post, the generated HTML and Javascript code? What browser are you using? Changing browser changes anything? Antonio
Re: How to enable the client side validation?
2008/3/26, Chen Chunwei [EMAIL PROTECTED]: As I said, I've already used html:javascript. Of course, I've alse done the other stuff found in the document you refer to (offline version). But it does not work. What exactly does not work? Give more details, for example, exceptions at startup of the application, or the Javascript code is not generated, etc. Antonio
Re: How to enable the client side validation?
I found the answer. There's an attribute in html:javascript named method. You can specify a name in this attribute such as validateForm. Then specify the onsubmit event of the actual form with return validateForm(this);. After all, the javascript works. The above solution comes from my colleague. But I wonder know is there any document refer to this? Or it should be a common sense? Talos - Original Message - From: Antonio Petrelli [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Wednesday, March 26, 2008 5:18 PM Subject: Re: How to enable the client side validation? 2008/3/26, Chen Chunwei [EMAIL PROTECTED]: Well, the case is that the Javascript code was generated well, but it was not triggered. Well, that's strange. Can you post, the generated HTML and Javascript code? What browser are you using? Changing browser changes anything? Antonio
Re: How to enable the client side validation?
2008/3/26, Chen Chunwei [EMAIL PROTECTED]: There's an attribute in html:javascript named method. You can specify a name in this attribute such as validateForm. Then specify the onsubmit event of the actual form with return validateForm(this);. After all, the javascript works. The above solution comes from my colleague. But I wonder know is there any document refer to this? Or it should be a common sense? Good catch. In fact, I think that the docs should be fixed, because also in the draft docs there is no reference about it: http://struts.apache.org/1.x/userGuide/building_view.html#validator So feel free to open an issue (and provide a patch, if you can :-) ): https://issues.apache.org/struts/browse/STR Antonio
Re: How to enable the client side validation?
Sorry for mis-typing. But I wonder know ... should be But I wanna know... Talos - Original Message - From: Chen Chunwei [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Wednesday, March 26, 2008 5:34 PM Subject: Re: How to enable the client side validation? I found the answer. There's an attribute in html:javascript named method. You can specify a name in this attribute such as validateForm. Then specify the onsubmit event of the actual form with return validateForm(this);. After all, the javascript works. The above solution comes from my colleague. But I wonder know is there any document refer to this? Or it should be a common sense? Talos - Original Message - From: Antonio Petrelli [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Wednesday, March 26, 2008 5:18 PM Subject: Re: How to enable the client side validation? 2008/3/26, Chen Chunwei [EMAIL PROTECTED]: Well, the case is that the Javascript code was generated well, but it was not triggered. Well, that's strange. Can you post, the generated HTML and Javascript code? What browser are you using? Changing browser changes anything? Antonio
Re: Client-side validation
Hi , I wish that you can get some idea about this from the following link, http://struts2issues.blogspot.com/ Struts2 Veronica Iturrioz wrote: I have a form with client side validation: s:form validate=true action=myAction namespace=/ theme=xhtml and an Action with some annotated validations: @Validations( requiredStrings = { @RequiredStringValidator( message = Required, type = ValidatorType.FIELD,fieldName = name, trim = true, key=error.required) but I get an error because of the key property. If I delete the key property, the client validation executes ok. In the package.properties I've the error.required key. How can I do this? I want to execute client-validation with key messages. I try to create a new theme, and replace form-close-validate.ftl : i replace the line:var error = ${validator.getMessage(action)?js_string}; for: #if validator.defaultMessage?has_content var error = ${validator.defaultMessage?js_string}; #else var error = ${action.getText(validator.getMessageKey())?js_string}; /#if but the client validation is not executed. Some themes do not support client-side validation. Only useful with theme xhtml/ajax thanks in advance. Veronica __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- View this message in context: http://www.nabble.com/Client-side-validation-tp1003p16002045.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Client-side validation
--- Struts2SG [EMAIL PROTECTED] wrote: I wish that you can get some idea about this from the following link, http://struts2issues.blogspot.com/ If you're going to post other people's answers on your blog it would be polite to properly attribute them. For example, I'm pretty sure It might have been quicker to look up the JavaDocs was me. I didn't see anything relating to the question being asked anyway. Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Struts 2 Client-side Validation
Hi all, Can password confirmation be validated using client side validators in Struts 2 ...? Thanks Thaminda
RE: Struts 2 Client-side Validation
Hello Thaminda, In strus 2 you can validate the forms using javascript. The good thing in strus 2 is that you don't have to write the code for validating the form. Code is automatically generated pease check http://www.roseindia.net/struts/struts2/struts-2-client-side-validation-exam ple.shtml Thanks -Original Message- From: Thaminda Karunanayake [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 27, 2008 3:51 PM To: user@struts.apache.org Subject: Struts 2 Client-side Validation Hi all, Can password confirmation be validated using client side validators in Struts 2 ...? Thanks Thaminda - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Struts 2 client side validation and preparable interceptor?
I have a couple of questions regarding the preparable interceptor: 1. By implementing the preparable interface alone I can have my prepare() method called before my action. Great, no problem. But If I want to utilize multiple prepare methods, e.g. prepareInput(), prepareCreate(), etc.. that does not work unless I add interceptors to my action like this: action name=userMgmt_* method={1} class=pages.userMgmt interceptor-ref name=params/ interceptor-ref name=prepare/ interceptor-ref name=basicStack/ result name=input/pages/userMgmt/createUser.jsp/result result name=create/pages/userMgmt/createUser.jsp/result result name=profile/pages/userMgmt/profile.jsp/result /action however, at that point none of my client side validation works anymore in my form in the JSP. Can anyone explain to me why this is? Am I missing something? What I am trying to do is have two JSPs, each with similiar forms that have client side validation, that use the same action bean but call different action methods and different prepare methods. The reason why I want to use the same action bean is that all the parameters are the same and they are both ultimately calling an update method that would be the same, so I do not need two action beans that would have the same methods. Thanks for any help you can give! John -- View this message in context: http://www.nabble.com/Struts-2-client-side-validation-and-preparable-interceptor--tp15502421p15502421.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts 2 client side validation and preparable interceptor?
jpiser wrote: I have a couple of questions regarding the preparable interceptor: 1. By implementing the preparable interface alone I can have my prepare() method called before my action. Great, no problem. But If I want to utilize multiple prepare methods, e.g. prepareInput(), prepareCreate(), etc.. that does not work unless I add interceptors to my action like this: Hmm, I haven't done that but I thought the prepare interceptor could do this without messing with the interceptor stack. Are you sure you need to do this? action name=userMgmt_* method={1} class=pages.userMgmt interceptor-ref name=params/ interceptor-ref name=prepare/ interceptor-ref name=basicStack/ result name=input/pages/userMgmt/createUser.jsp/result result name=create/pages/userMgmt/createUser.jsp/result result name=profile/pages/userMgmt/profile.jsp/result /action however, at that point none of my client side validation works anymore in my form in the JSP. Can anyone explain to me why this is? Am I missing something? Probably basicStack doesn't include some of the interceptors that need to be there for client side validation to work. When you specify interceptors on an action like that, you override the set of interceptors that would otherwise be applied. Have you tried replacing the interceptor-ref elements with a single reference to the paramsPrepareParams stack, or changing the final one to reference defaultStack instead of basicStack? L. What I am trying to do is have two JSPs, each with similiar forms that have client side validation, that use the same action bean but call different action methods and different prepare methods. The reason why I want to use the same action bean is that all the parameters are the same and they are both ultimately calling an update method that would be the same, so I do not need two action beans that would have the same methods. Thanks for any help you can give! John - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Struts 2: client side validation message kept displaying repeatedly
I enabled client side validation for a form, when the user submits, the validation kicks in and the messages are shown. If the user didn't make any changes and proceed to submit again, the set messages are shown again. The messages kept increasing. Is there a way to clear the old messages before showing the new ones?
RE: Client side validation for radio button
In this case it is the xhtml theme. (Isn't specified in the s:head tag but using the default specified in struts.properties.) _ Mitch Claborn [EMAIL PROTECTED] -Original Message- From: Martin Gainty [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 11, 2000 5:52 PM To: Struts Users Mailing List Subject: Re: Client side validation for radio button in your jsp head tag.. s:head theme=?/ what value have you assigned to theme? M- - Original Message - From: Mitch Claborn [EMAIL PROTECTED] To: 'Struts Users Mailing List' user@struts.apache.org Sent: Thursday, October 11, 2007 5:38 PM Subject: Client side validation for radio button Using the xhtml theme, client-side validation for radio button is not working. I've tried both required and requiredstring but I suspect that none will work. The javascript code (from form-close-validation.ftl) does this: function validateForm_Question() { form = document.getElementById(Question); if (form.elements['q1']) { field = form.elements['q1']; var error = Please answer q1; if (field.value == ) { addError(field, error); errors = true; } } Which doesn't get the actual value of the selected radio. I can code a workaround in form-close-validation.ftl but it seems like this would have been solved already? Mitch Claborn [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Client side validation for radio button
Using the xhtml theme, client-side validation for radio button is not working. I've tried both required and requiredstring but I suspect that none will work. The javascript code (from form-close-validation.ftl) does this: function validateForm_Question() { form = document.getElementById(Question); if (form.elements['q1']) { field = form.elements['q1']; var error = Please answer q1; if (field.value == ) { addError(field, error); errors = true; } } Which doesn't get the actual value of the selected radio. I can code a workaround in form-close-validation.ftl but it seems like this would have been solved already? Mitch Claborn [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Client side validation for radio button
in your jsp head tag.. s:head theme=?/ what value have you assigned to theme? M- - Original Message - From: Mitch Claborn [EMAIL PROTECTED] To: 'Struts Users Mailing List' user@struts.apache.org Sent: Thursday, October 11, 2007 5:38 PM Subject: Client side validation for radio button Using the xhtml theme, client-side validation for radio button is not working. I've tried both required and requiredstring but I suspect that none will work. The javascript code (from form-close-validation.ftl) does this: function validateForm_Question() { form = document.getElementById(Question); if (form.elements['q1']) { field = form.elements['q1']; var error = Please answer q1; if (field.value == ) { addError(field, error); errors = true; } } Which doesn't get the actual value of the selected radio. I can code a workaround in form-close-validation.ftl but it seems like this would have been solved already? Mitch Claborn [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]
Re: Reg : Client side Validation on Indexed Collection
kukreja sanjeev wrote: Hi , I am trying to put validations on indexed collection. Is there any way I can have that in validation-action.xml file. It would be great if you can pls.throw some light on it. Which version of Struts are you using? Struts 1 lets you specify multiple validation files in the configuration, but wont automatically search for per-action validation files. Struts 2 can find validation rules in various places automatically, including per-action files. See 'Defining Validation Rules' in the validation documentation [1] for details. L. [1] http://struts.apache.org/2.x/docs/validation.html ObWhine: please don't post unrelated questions to an existing thread. Be sure to start a new thread (with an appropriate subject) by sending a fresh message to the list, rather than using Reply To. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Reg : Client side Validation on Indexed Collection
Hi , I am trying to put validations on indexed collection. Is there any way I can have that in validation-action.xml file. It would be great if you can pls.throw some light on it. Thanks in advance, Sanjeev - Looking for a deal? Find great prices on flights and hotels with Yahoo! FareChase.
struts 2 client side validation with JBoss (portal server)
Hello, I tried to use client side validation on my portal (portlet) with struts 2. It seems to me, that struts 2 just failed to generate client side validation JavaScript. My question is, is this a known bug, known defect or it should not work anyway? It seems just the JavaScript from the end of the JSP is missing. Server side validation just work fine. The same application (project) work fine under Tomcat. Does anyone succeed with client side validation under portlet? -- tamas
Re: struts 2 client side validation with JBoss (portal server)
Client side validation is not currently supported in portlets. You might get it to work, but there are unresolved issues with escaping/namespaces etc of javascript function names and variables. You can register it as a JIRA issue, and hopefully we'll be able to resolve it in a future release. Nils-H On 8/28/07, Gervai, Tamas (GE Money, consultant) [EMAIL PROTECTED] wrote: Hello, I tried to use client side validation on my portal (portlet) with struts 2. It seems to me, that struts 2 just failed to generate client side validation JavaScript. My question is, is this a known bug, known defect or it should not work anyway? It seems just the JavaScript from the end of the JSP is missing. Server side validation just work fine. The same application (project) work fine under Tomcat. Does anyone succeed with client side validation under portlet? -- tamas - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[S2]: Client-side validation per method
Hi, I'm trying to use client-side validation with annotations in my action methods. But for all methods executes the same javascript validation. I want different validations for different methods. How can I do that? I put @SkipValidation in some methods. thanks, Veronica Boardwalk for $500? In 2007? Ha! Play Monopoly Here and Now (it's updated for today's economy) at Yahoo! Games. http://get.games.yahoo.com/proddesc?gamekey=monopolyherenow
Re: [S2] Client side validation, hidden fields and clearErrorMessages not working in firefox
I have created an issue in JIRA. (https://issues.apache.org/struts/browse/WW-2058) max Theo Platt wrote: Thanks Max, I've just been looking at exactly the same area and I can replicate the same error. It works fine in IE but fails in firefox. I think you should enter it in JIRA. Cheers Theo maxmil wrote: I'm using 2.0.8 and using client side validation which its almost working perfectly. Unfortunately the only obstacle is that i can't put hidden fields in my form. The validation works correctly the problem is that the second time i validate the same form (without sending it to the server) the initial error messages are not removed due to a faliure in the functions I will explain... When you set validate=true in your form tag a javascript import to the file struts/xhtml/validation.js is included in the page. This import includes the function clearErrorMessages. The idea is that this function should clear the error messages before each validation. The way it works is by looking for the first element in the form, it should be the field table, and then removing all rows which have the attribute errorFor. The problem comes when you put hidden fields in the form. Regardless of where you put them in the html in firefox they are always moved to the top of the forms child elements in the dom tree. (This ocurrs in firefox but not in IE where the function works correctly). When the clearErrorMessages function finds that the first child of the form is not a table but an input it returns without clearing the error messages. A solution would be to iterate over the form elements until the table is found rather than expecting it to be the first element. I think that this is a bug but i've not found anything in JIRA. max - 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]
How to do Server/Client Side Validation with a model object that has a list
Hi I have a model object thas has a list containing a model object. How do I configure my Action-validator.xml file to validate each model inside the list? Regards, Néstor Boscán
Struts 2 Client Side Validation
Hi I'm trying to use Struts 2 with client side validation. I would like to use a theme that does not add any HTML to the form, fields and error messages. I'm working with simple theme but it's not generating the JavaScript code to do the validation and the s:fielderror/ tag is generation ulli//ul elements. Any ideas? Regards, Néstor Boscán
RE: Struts 2 Client Side Validation
HI, Please check http://www.roseindia.net/struts/struts2/struts-2-client-side-validation-exam ple.shtml Thanks -Original Message- From: Néstor Boscán [mailto:[EMAIL PROTECTED] Sent: Friday, July 13, 2007 1:05 AM To: user@struts.apache.org Subject: Struts 2 Client Side Validation Hi I'm trying to use Struts 2 with client side validation. I would like to use a theme that does not add any HTML to the form, fields and error messages. I'm working with simple theme but it's not generating the JavaScript code to do the validation and the s:fielderror/ tag is generation ulli//ul elements. Any ideas? Regards, Néstor Boscán - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [S2] Client side validation, hidden fields and clearErrorMessages not working in firefox
Thanks Max, I've just been looking at exactly the same area and I can replicate the same error. It works fine in IE but fails in firefox. I think you should enter it in JIRA. Cheers Theo maxmil wrote: I'm using 2.0.8 and using client side validation which its almost working perfectly. Unfortunately the only obstacle is that i can't put hidden fields in my form. The validation works correctly the problem is that the second time i validate the same form (without sending it to the server) the initial error messages are not removed due to a faliure in the functions I will explain... When you set validate=true in your form tag a javascript import to the file struts/xhtml/validation.js is included in the page. This import includes the function clearErrorMessages. The idea is that this function should clear the error messages before each validation. The way it works is by looking for the first element in the form, it should be the field table, and then removing all rows which have the attribute errorFor. The problem comes when you put hidden fields in the form. Regardless of where you put them in the html in firefox they are always moved to the top of the forms child elements in the dom tree. (This ocurrs in firefox but not in IE where the function works correctly). When the clearErrorMessages function finds that the first child of the form is not a table but an input it returns without clearing the error messages. A solution would be to iterate over the form elements until the table is found rather than expecting it to be the first element. I think that this is a bug but i've not found anything in JIRA. max - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/-S2--Client-side-validation%2C-hidden-fields-and-clearErrorMessages-not-working-in-firefox-tf4028991.html#a11517491 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[S2] Client side validation, hidden fields and clearErrorMessages not working in firefox
I'm using 2.0.8 and using client side validation which its almost working perfectly. Unfortunately the only obstacle is that i can't put hidden fields in my form. The validation works correctly the problem is that the second time i validate the same form (without sending it to the server) the initial error messages are not removed due to a faliure in the functions I will explain... When you set validate=true in your form tag a javascript import to the file struts/xhtml/validation.js is included in the page. This import includes the function clearErrorMessages. The idea is that this function should clear the error messages before each validation. The way it works is by looking for the first element in the form, it should be the field table, and then removing all rows which have the attribute errorFor. The problem comes when you put hidden fields in the form. Regardless of where you put them in the html in firefox they are always moved to the top of the forms child elements in the dom tree. (This ocurrs in firefox but not in IE where the function works correctly). When the clearErrorMessages function finds that the first child of the form is not a table but an input it returns without clearing the error messages. A solution would be to iterate over the form elements until the table is found rather than expecting it to be the first element. I think that this is a bug but i've not found anything in JIRA. max - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[S2] Problems with client side validation
Hi, I try the client side validation with Struts 2. The validation is well done, but I have many problems : - For each datetimepicker field in my form, I have the following Javascript error, which displays in a pop up : TypeError: row.cells has no properties - Another problem with datetimepicker fields is that the message is displayes between the label and the input zone, while it is displayed above for other field types (textfield, textarea, select) - There is no validation for radio buttons ! - When I submit again the form, the validation messages are not cleared so they are displayed twice A link to my JSP page : http://rafb.net/p/IdtjnW49.html A link to my XML validation file : http://rafb.net/p/i6nbmD67.html Thanks for any help ;) Olivier
Need help in client side validation in Struts 2.0
hi, If somebody have some information about client side validation in Stutrs2. 0 then send me .I am in a desperate need of the same . thanks Arunabh -- View this message in context: http://www.nabble.com/Need-help-in-client-side-validation-in-Struts-2.0-tf3605223.html#a10072395 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Need help in client side validation in Struts 2.0
arunabh wrote: hi, If somebody have some information about client side validation in Stutrs2. 0 then send me .I am in a desperate need of the same . thanks Arunabh Well, you could start with the documentation: http://struts.apache.org/2.x/docs/validation.html http://struts.apache.org/2.x/docs/client-side-validation.html L. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Client-side validation
I have a form with client side validation: s:form validate=true action=myAction namespace=/ theme=xhtml and an Action with some annotated validations: @Validations( requiredStrings = { @RequiredStringValidator( message = Required, type = ValidatorType.FIELD,fieldName = name, trim = true, key=error.required) but I get an error because of the key property. If I delete the key property, the client validation executes ok. In the package.properties I've the error.required key. How can I do this? I want to execute client-validation with key messages. I try to create a new theme, and replace form-close-validate.ftl : i replace the line:var error = ${validator.getMessage(action)?js_string}; for: #if validator.defaultMessage?has_content var error = ${validator.defaultMessage?js_string}; #else var error = ${action.getText(validator.getMessageKey())?js_string}; /#if but the client validation is not executed. Some themes do not support client-side validation. Only useful with theme xhtml/ajax thanks in advance. Veronica __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
Re: client side validation on included form
I have found a solution to this. The good news is it is a simple pass-through to the dojo contentpane. changing this: s:div theme=ajax href=PersonByAge_input.action executeScripts=true / to this: div dojoType=ContentPane href=s:url action=PersonByAge_input / scriptSeparation=false executeScripts=true /div fixes the issue. Could the developers add a passthrough to the dojo scriptSeparation property? On 2/21/07, C. Adams [EMAIL PROTECTED] wrote: I have a form that I access via an action on an ajax-ish page. (Form and results are on same page) It's working great, but I can't figure out the validation. The page looks like this now: s:div theme=ajax href=PersonByAge_input.action executeScripts=true / s:div id=resultBox theme=ajax / with the form looking like this: s:form action=PersonByAge theme=css_xhtml validate=true Betweenbr/ s:textfield name=startYear label=Years labelposition=top / br clear=left/andbr/ s:textfield name=endYear label=Years labelposition=top / br clear=left/ s:submit value=Find People theme=ajax targets=resultBox/ /s:form With validation false, it works great. With validation true, I get an error ReferenceError: validateForm_PersonByAge is not defined and when I look in the generated source, there are no javascript validation methods in the source. but if I access the PersonByAge_input.action directly, the validation methods are there in the source. Have I hit a not quite ready area of the ajax theme? Thanks.
Re: client side validation on included form
Can you log a Jira ticket with the request? thanks musachy On 2/22/07, C. Adams [EMAIL PROTECTED] wrote: I have found a solution to this. The good news is it is a simple pass-through to the dojo contentpane. changing this: s:div theme=ajax href=PersonByAge_input.action executeScripts=true / to this: div dojoType=ContentPane href=s:url action=PersonByAge_input / scriptSeparation=false executeScripts=true /div fixes the issue. Could the developers add a passthrough to the dojo scriptSeparation property? On 2/21/07, C. Adams [EMAIL PROTECTED] wrote: I have a form that I access via an action on an ajax-ish page. (Form and results are on same page) It's working great, but I can't figure out the validation. The page looks like this now: s:div theme=ajax href=PersonByAge_input.action executeScripts=true / s:div id=resultBox theme=ajax / with the form looking like this: s:form action=PersonByAge theme=css_xhtml validate=true Betweenbr/ s:textfield name=startYear label=Years labelposition=top / br clear=left/andbr/ s:textfield name=endYear label=Years labelposition=top / br clear=left/ s:submit value=Find People theme=ajax targets=resultBox/ /s:form With validation false, it works great. With validation true, I get an error ReferenceError: validateForm_PersonByAge is not defined and when I look in the generated source, there are no javascript validation methods in the source. but if I access the PersonByAge_input.action directly, the validation methods are there in the source. Have I hit a not quite ready area of the ajax theme? Thanks. -- Hey you! Would you help me to carry the stone? Pink Floyd
client side validation on included form
I have a form that I access via an action on an ajax-ish page. (Form and results are on same page) It's working great, but I can't figure out the validation. The page looks like this now: s:div theme=ajax href=PersonByAge_input.action executeScripts=true / s:div id=resultBox theme=ajax / with the form looking like this: s:form action=PersonByAge theme=css_xhtml validate=true Betweenbr/ s:textfield name=startYear label=Years labelposition=top / br clear=left/andbr/ s:textfield name=endYear label=Years labelposition=top / br clear=left/ s:submit value=Find People theme=ajax targets=resultBox/ /s:form With validation false, it works great. With validation true, I get an error ReferenceError: validateForm_PersonByAge is not defined and when I look in the generated source, there are no javascript validation methods in the source. but if I access the PersonByAge_input.action directly, the validation methods are there in the source. Have I hit a not quite ready area of the ajax theme? Thanks.
Re: Client Side Validation
Dear Chetan Look at your bean form definition in your validation.xml if you specify the form bean like this : formset form name=attendeeDetailsForm /form /formset then you should call generated javascript with this html:javascript formName=attendeeDetailsForm/ the first letter in form bean name shouls be in lowercase also... HTH Irwan On 8/3/06, Chetan Pandey [EMAIL PROTECTED] wrote: Hi All: This is what I am doing. html:form action=/addAttendeeDetails onsubmit=return validateAttendeeDetailsForm(this) . . . . . . html:javascript formName=AttendeeDetailsForm/ /html:form But the Code only does Server Side Validation. Am I missing naything pls. Thanks. Chetan Pandey -Original Message- From: Romu [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 02, 2006 3:28 PM To: Struts Users Mailing List Subject: Re: Client Side Validation your form shoud have been named : attendeeDetailsForm, like bean no caps for first letter . then validateAttendeeDeta onsubmit=validateAttendeeDeta ilsForm (); or validateAttendeeDeta onsubmit=validateAttendeeDeta ilsForm (this); u can see the javascript generated in the source of your jsp btw . hope it helps 2006/8/2, Chetan Pandey [EMAIL PROTECTED]: I have this: html:form action=/addAttendeeDetails onsubmit=return validateRequired(this) Where validateRequired comes from the following Javascript code in my validator-rules.xml validator name=required classname=org.apache.struts.validator.FieldChecks method=validateRequired methodParams=java.lang.Object, org.apache.commons.validator.ValidatorAction, org.apache.commons.validator.Field, org.apache.struts.action.ActionMessages, org.apache.commons.validator.Validator, javax.servlet.http.HttpServletRequest msg=errors.required javascript![CDATA[ function validateRequired(form) { } ]] /javascript /validator But no Client-side Validation is occuring -Original Message- From: Lixin Chu [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 02, 2006 10:35 AM To: Struts Users Mailing List Subject: Re: Client Side Validation do you have something like: onsubmit=validateAttendeeDetailsForm (this); in html:form ? and form name is not attendeeDetailsForn ? - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Client Side Validation
I have changed the name to attendeeDetailsForm everywhere as you have suggested And have html:form action=/addAttendeeDetails onsubmit=return validateAttendeeDetailsForm(this) But this is not helping me still. I only get Server side validation, no Client Side Validation. Thanks. Chetan Pandey -Original Message- From: Irwan Nurwandi [mailto:[EMAIL PROTECTED] Sent: Thursday, August 03, 2006 2:13 PM To: Struts Users Mailing List Subject: Re: Client Side Validation Dear Chetan Look at your bean form definition in your validation.xml if you specify the form bean like this : formset form name=attendeeDetailsForm /form /formset then you should call generated javascript with this html:javascript formName=attendeeDetailsForm/ the first letter in form bean name shouls be in lowercase also... HTH Irwan On 8/3/06, Chetan Pandey [EMAIL PROTECTED] wrote: Hi All: This is what I am doing. html:form action=/addAttendeeDetails onsubmit=return validateAttendeeDetailsForm(this) . . . . . . html:javascript formName=AttendeeDetailsForm/ /html:form But the Code only does Server Side Validation. Am I missing naything pls. Thanks. Chetan Pandey -Original Message- From: Romu [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 02, 2006 3:28 PM To: Struts Users Mailing List Subject: Re: Client Side Validation your form shoud have been named : attendeeDetailsForm, like bean no caps for first letter . then validateAttendeeDeta onsubmit=validateAttendeeDeta ilsForm (); or validateAttendeeDeta onsubmit=validateAttendeeDeta ilsForm (this); u can see the javascript generated in the source of your jsp btw . hope it helps 2006/8/2, Chetan Pandey [EMAIL PROTECTED]: I have this: html:form action=/addAttendeeDetails onsubmit=return validateRequired(this) Where validateRequired comes from the following Javascript code in my validator-rules.xml validator name=required classname=org.apache.struts.validator.FieldChecks method=validateRequired methodParams=java.lang.Object, org.apache.commons.validator.ValidatorAction, org.apache.commons.validator.Field, org.apache.struts.action.ActionMessages, org.apache.commons.validator.Validator, javax.servlet.http.HttpServletRequest msg=errors.required javascript![CDATA[ function validateRequired(form) { } ]] /javascript /validator But no Client-side Validation is occuring -Original Message- From: Lixin Chu [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 02, 2006 10:35 AM To: Struts Users Mailing List Subject: Re: Client Side Validation do you have something like: onsubmit=validateAttendeeDetailsForm (this); in html:form ? and form name is not attendeeDetailsForn ? - 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] - 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]
Re: Client Side Validation
your form shoud have been named : attendeeDetailsForm, like bean no caps for first letter . then validateAttendeeDeta onsubmit=validateAttendeeDeta ilsForm (); or validateAttendeeDeta onsubmit=validateAttendeeDeta ilsForm (this); u can see the javascript generated in the source of your jsp btw . hope it helps 2006/8/2, Chetan Pandey [EMAIL PROTECTED]: I have this: html:form action=/addAttendeeDetails onsubmit=return validateRequired(this) Where validateRequired comes from the following Javascript code in my validator-rules.xml validator name=required classname=org.apache.struts.validator.FieldChecks method=validateRequired methodParams=java.lang.Object, org.apache.commons.validator.ValidatorAction, org.apache.commons.validator.Field, org.apache.struts.action.ActionMessages, org.apache.commons.validator.Validator, javax.servlet.http.HttpServletRequest msg=errors.required javascript![CDATA[ function validateRequired(form) { } ]] /javascript /validator But no Client-side Validation is occuring -Original Message- From: Lixin Chu [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 02, 2006 10:35 AM To: Struts Users Mailing List Subject: Re: Client Side Validation do you have something like: onsubmit=validateAttendeeDetailsForm (this); in html:form ? and form name is not attendeeDetailsForn ? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Client Side Validation
Hi All: This is what I am doing. html:form action=/addAttendeeDetails onsubmit=return validateAttendeeDetailsForm(this) . . . . . . html:javascript formName=AttendeeDetailsForm/ /html:form But the Code only does Server Side Validation. Am I missing naything pls. Thanks. Chetan Pandey -Original Message- From: Romu [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 02, 2006 3:28 PM To: Struts Users Mailing List Subject: Re: Client Side Validation your form shoud have been named : attendeeDetailsForm, like bean no caps for first letter . then validateAttendeeDeta onsubmit=validateAttendeeDeta ilsForm (); or validateAttendeeDeta onsubmit=validateAttendeeDeta ilsForm (this); u can see the javascript generated in the source of your jsp btw . hope it helps 2006/8/2, Chetan Pandey [EMAIL PROTECTED]: I have this: html:form action=/addAttendeeDetails onsubmit=return validateRequired(this) Where validateRequired comes from the following Javascript code in my validator-rules.xml validator name=required classname=org.apache.struts.validator.FieldChecks method=validateRequired methodParams=java.lang.Object, org.apache.commons.validator.ValidatorAction, org.apache.commons.validator.Field, org.apache.struts.action.ActionMessages, org.apache.commons.validator.Validator, javax.servlet.http.HttpServletRequest msg=errors.required javascript![CDATA[ function validateRequired(form) { } ]] /javascript /validator But no Client-side Validation is occuring -Original Message- From: Lixin Chu [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 02, 2006 10:35 AM To: Struts Users Mailing List Subject: Re: Client Side Validation do you have something like: onsubmit=validateAttendeeDetailsForm (this); in html:form ? and form name is not attendeeDetailsForn ? - 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]
Client Side Validation
Hi All: I am trying to do Client-Side Validation for my JSP Form: html:javascript formName=AttendeeDetailsForm/ html:errors/ html:form action=/addAttendeeDetails . . . . /html:form But the problem is I only see Server Side Validations no Client Side Validations. This is the Validator I am using which I copied from the Net: /*** / validator name=required classname=org.apache.struts.validator.FieldChecks method=validateRequired methodParams=java.lang.Object, org.apache.commons.validator.ValidatorAction, org.apache.commons.validator.Field, org.apache.struts.action.ActionMessages, org.apache.commons.validator.Validator, javax.servlet.http.HttpServletRequest msg=errors.required javascript![CDATA[ function validateRequired(form) { var isValid = true; var focusField = null; var i = 0; var fields = new Array(); oRequired = new required(); for (x in oRequired) { var field = form[oRequired[x][0]]; if (field.type == 'text' || field.type == 'textarea' || field.type == 'file' || field.type == 'select-one' || field.type == 'radio' || field.type == 'password') { var value = ''; // get field's value if (field.type == select-one) { var si = field.selectedIndex; if (si = 0) { value = field.options[si].value; } } else { value = field.value; } if (trim(value).length == 0) { if (i == 0) { focusField = field; } fields[i++] = oRequired[x][1]; isValid = false; } } } if (fields.length 0) { focusField.focus(); alert(fields.join('\n')); } return isValid; } // Trim whitespace from left and right sides of s. function trim(s) { return s.replace( /^\s*/, ).replace( /\s*$/, ); } ]] /javascript /validator /***/ Does anyone have any Idea why I don't see Client Side Validation
Re: Client Side Validation
do you have something like: onsubmit=validateAttendeeDetailsForm (this); in html:form ? and form name is not attendeeDetailsForn ?
RE: Client Side Validation
I have this: html:form action=/addAttendeeDetails onsubmit=return validateRequired(this) Where validateRequired comes from the following Javascript code in my validator-rules.xml validator name=required classname=org.apache.struts.validator.FieldChecks method=validateRequired methodParams=java.lang.Object, org.apache.commons.validator.ValidatorAction, org.apache.commons.validator.Field, org.apache.struts.action.ActionMessages, org.apache.commons.validator.Validator, javax.servlet.http.HttpServletRequest msg=errors.required javascript![CDATA[ function validateRequired(form) { } ]] /javascript /validator But no Client-side Validation is occuring -Original Message- From: Lixin Chu [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 02, 2006 10:35 AM To: Struts Users Mailing List Subject: Re: Client Side Validation do you have something like: onsubmit=validateAttendeeDetailsForm (this); in html:form ? and form name is not attendeeDetailsForn ? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
is there any way to customize the client side validation popup window
Hi All, would like to know if there is any way to customize the client side validation popup window ? i am using struts client side validator. thanks lixin
RE: is there any way to customize the client side validation popup window
If you mean the Browser pop up window, then no. You could think about server side validation and generating custom pop-ups using Javascript. Harsh. -Original Message- From: Lixin Chu [mailto:[EMAIL PROTECTED] Sent: Friday, May 19, 2006 4:59 PM To: Struts Users Mailing List Subject: is there any way to customize the client side validation popup window Hi All, would like to know if there is any way to customize the client side validation popup window ? i am using struts client side validator. thanks lixin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[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]
[Shale] commons client side validation not working inside a dataList
I tried using the commons validation features of Shale. The application is using Myfaces 1.1.1. The validation javascript is being written back to the browser. The server side validation is working fine but a javascript `field error occurs during the . However there is a problem with the client side input element Id's that the javascript validation is looking for versus the client side id's that are generated by the dataList. The page i tried validation on has a Myfaces dataList inside a form, and for each iteration through the list there are inputs. Basically a dataList will append the `row index` to the client side Id to guarantee uniqueness, as in myForm:myDataList_0:someRequiredField for the first row, myForm:myDataList_1:someRequiredField for the second, and so on. But in the rendering of the javascript by the struts validatorScript tag, the clientId of the input components lose their row index. I have created an illustrative example that generates the same problem. The code is included below and the inline comments hopefully explain what's happening. To keep things simple there is no backing bean, and I use a class from shale-core to give me some objects to edit, so all you'd just need to deploy into a shale-core based blank web-app. My application page is more complex than this but I am running into exact the same problem withthe validation javascript Does this look familiar to anyone? Any workarounds, solutions?... Thanks -- Paul Devine %@ page language=java import=java.util.*, org.apache.shale.dialog.impl.DialogImpl% %@ taglib uri=http://java.sun.com/jsf/html; prefix=h % %@ taglib uri=http://java.sun.com/jsf/core; prefix=f % %@ taglib uri=http://myfaces.apache.org/extensions; prefix=t% %@ taglib uri=http://struts.apache.org/shale/core; prefix=s % % /* Put a couple of Shale DialogImpl objects into the session (we just need an object with a getter and a setter * and this class is readily accessible) */ List inputObjects = new ArrayList(); inputObjects.add(new DialogImpl()); inputObjects.add(new DialogImpl()); session.setAttribute(someInputObjects,inputObjects); % f:view %-- A form with a dataList of inputs. The client side id's of the components will be someForm:someDataList_0:someRequiredField and someForm:someDataList_1:someRequiredField --% h:form id=someForm onsubmit=return validateForm(this); t:dataList id=someDataList value=#{someInputObjects} var=object rowIndexVar=index h:outputLabel value=Name/ h:inputText id=someRequiredField value=#{object.name} size=20 required=true s:commonsValidator type=required arg=Name server=true client=true/ /h:inputTexth:message for=someRequiredField errorClass=errorMessage/ /t:dataList %-- The dataList is now closed. Before we close out the form, write out the validator javascript. But this results in a mismatch on the client side id's in the required function. Note the uniqueness indexes _0 and _1 are missing. Because we are outside the dataList there is no row index anymore (and for some reason the HtmlInputText components `calculate` their clientId's again when asked for getClientId from Shale's ValidatorScript findCommonsValidators method Here's what the validatorScript comes up with:- function required() { this[0] = new Array(someForm:someDataList:someRequiredField, Name is required., new Function(x, return {}[x];)); } --% s:validatorScript functionName=validateForm/ h:commandButton action=submit/ /h:form /f:view
SV: [Shale] commons client side validation not working inside a dataList
Hi Did I hear forceId? - You need to use this attribute to force the name to be what you want. Hermod -Opprinnelig melding- Fra: Paul Devine [mailto:[EMAIL PROTECTED] Sendt: 29. mars 2006 22:47 Til: user@struts.apache.org Emne: [Shale] commons client side validation not working inside a dataList I tried using the commons validation features of Shale. The application is using Myfaces 1.1.1. The validation javascript is being written back to the browser. The server side validation is working fine but a javascript `field error occurs during the . However there is a problem with the client side input element Id's that the javascript validation is looking for versus the client side id's that are generated by the dataList. The page i tried validation on has a Myfaces dataList inside a form, and for each iteration through the list there are inputs. Basically a dataList will append the `row index` to the client side Id to guarantee uniqueness, as in myForm:myDataList_0:someRequiredField for the first row, myForm:myDataList_1:someRequiredField for the second, and so on. But in the rendering of the javascript by the struts validatorScript tag, the clientId of the input components lose their row index. I have created an illustrative example that generates the same problem. The code is included below and the inline comments hopefully explain what's happening. To keep things simple there is no backing bean, and I use a class from shale-core to give me some objects to edit, so all you'd just need to deploy into a shale-core based blank web-app. My application page is more complex than this but I am running into exact the same problem withthe validation javascript Does this look familiar to anyone? Any workarounds, solutions?... Thanks -- Paul Devine %@ page language=java import=java.util.*, org.apache.shale.dialog.impl.DialogImpl% %@ taglib uri=http://java.sun.com/jsf/html; prefix=h % %@ taglib uri=http://java.sun.com/jsf/core; prefix=f % %@ taglib uri=http://myfaces.apache.org/extensions; prefix=t% %@ taglib uri=http://struts.apache.org/shale/core; prefix=s % % /* Put a couple of Shale DialogImpl objects into the session (we just need an object with a getter and a setter * and this class is readily accessible) */ List inputObjects = new ArrayList(); inputObjects.add(new DialogImpl()); inputObjects.add(new DialogImpl()); session.setAttribute(someInputObjects,inputObjects); % f:view %-- A form with a dataList of inputs. The client side id's of the components will be someForm:someDataList_0:someRequiredField and someForm:someDataList_1:someRequiredField --% h:form id=someForm onsubmit=return validateForm(this); t:dataList id=someDataList value=#{someInputObjects} var=object rowIndexVar=index h:outputLabel value=Name/ h:inputText id=someRequiredField value=#{object.name} size=20 required=true s:commonsValidator type=required arg=Name server=true client=true/ /h:inputTexth:message for=someRequiredField errorClass=errorMessage/ /t:dataList %-- The dataList is now closed. Before we close out the form, write out the validator javascript. But this results in a mismatch on the client side id's in the required function. Note the uniqueness indexes _0 and _1 are missing. Because we are outside the dataList there is no row index anymore (and for some reason the HtmlInputText components `calculate` their clientId's again when asked for getClientId from Shale's ValidatorScript findCommonsValidators method Here's what the validatorScript comes up with:- function required() { this[0] = new Array(someForm:someDataList:someRequiredField, Name is required., new Function(x, return {}[x];)); } --% s:validatorScript functionName=validateForm/ h:commandButton action=submit/ /h:form /f:view - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [Shale] commons client side validation not working inside a dataList
Thanks Hermod When I use t:inputText with forceid=true, I still get the javascript error. In that case, the client side inputs that are generated are: labelName/labelinput id=someRequiredField[0] name=someRequiredField[0] type=text value= size=20 / labelName/labelinput id=someRequiredField[1] name=someRequiredField[1] type=text value= size=20 / and the generated javascript validation routine is still missing the uniqueness index:- function required() { this[0] = new Array(someRequiredField, Name is required., new Function(x, return {}[x];)); } I would think I need the required() function to be something like the following for all this to work: function required() { this[0] = new Array(someRequiredField[0], Name is required., new Function(x, return {}[x];)); this[1] = new Array(someRequiredField[1], Name is required., new Function(x, return {}[x];)); } ?... Thanks -- Paul On 3/29/06, Hermod Opstvedt [EMAIL PROTECTED] wrote: Hi Did I hear forceId? - You need to use this attribute to force the name to be what you want. Hermod -Opprinnelig melding- Fra: Paul Devine [mailto:[EMAIL PROTECTED] Sendt: 29. mars 2006 22:47 Til: user@struts.apache.org Emne: [Shale] commons client side validation not working inside a dataList I tried using the commons validation features of Shale. The application is using Myfaces 1.1.1. The validation javascript is being written back to the browser. The server side validation is working fine but a javascript `field error occurs during the . However there is a problem with the client side input element Id's that the javascript validation is looking for versus the client side id's that are generated by the dataList. The page i tried validation on has a Myfaces dataList inside a form, and for each iteration through the list there are inputs. Basically a dataList will append the `row index` to the client side Id to guarantee uniqueness, as in myForm:myDataList_0:someRequiredField for the first row, myForm:myDataList_1:someRequiredField for the second, and so on. But in the rendering of the javascript by the struts validatorScript tag, the clientId of the input components lose their row index. I have created an illustrative example that generates the same problem. The code is included below and the inline comments hopefully explain what's happening. To keep things simple there is no backing bean, and I use a class from shale-core to give me some objects to edit, so all you'd just need to deploy into a shale-core based blank web-app. My application page is more complex than this but I am running into exact the same problem withthe validation javascript Does this look familiar to anyone? Any workarounds, solutions?... Thanks -- Paul Devine %@ page language=java import=java.util.*, org.apache.shale.dialog.impl.DialogImpl% %@ taglib uri=http://java.sun.com/jsf/html; prefix=h % %@ taglib uri=http://java.sun.com/jsf/core; prefix=f % %@ taglib uri=http://myfaces.apache.org/extensions; prefix=t% %@ taglib uri=http://struts.apache.org/shale/core; prefix=s % % /* Put a couple of Shale DialogImpl objects into the session (we just need an object with a getter and a setter * and this class is readily accessible) */ List inputObjects = new ArrayList(); inputObjects.add(new DialogImpl()); inputObjects.add(new DialogImpl()); session.setAttribute(someInputObjects,inputObjects); % f:view %-- A form with a dataList of inputs. The client side id's of the components will be someForm:someDataList_0:someRequiredField and someForm:someDataList_1:someRequiredField --% h:form id=someForm onsubmit=return validateForm(this); t:dataList id=someDataList value=#{someInputObjects} var=object rowIndexVar=index h:outputLabel value=Name/ h:inputText id=someRequiredField value=#{object.name} size=20 required=true s:commonsValidator type=required arg=Name server=true client=true/ /h:inputTexth:message for=someRequiredField errorClass=errorMessage/ /t:dataList %-- The dataList is now closed. Before we close out the form, write out the validator javascript. But this results in a mismatch on the client side id's in the required function. Note the uniqueness indexes _0 and _1 are missing. Because we are outside the dataList there is no row index anymore (and for some reason the HtmlInputText components `calculate` their clientId's again when asked for getClientId from Shale's ValidatorScript findCommonsValidators method Here's what the validatorScript comes up with:- function required() { this[0] = new Array(someForm:someDataList:someRequiredField, Name is required., new Function(x, return {}[x];)); } --% s:validatorScript functionName=validateForm/ h:commandButton action=submit/ /h:form /f:view - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: SV: [Shale] commons client side validation not working inside a dataList
Why would that be needed? The s:commonsValidator tag should render Javascript referencing the actual rendered ID of the component it's attached to. I haven't played much with validators, much less validators for components inside dataLists, but I would have thought this should be able to work as it is. Paul, could you include your sample JSP and, if possible, copy/paste the rendered HTML as well, in a Bugzilla ticket so the issue gets tracked? L. Hermod Opstvedt wrote: Hi Did I hear forceId? - You need to use this attribute to force the name to be what you want. Hermod -Opprinnelig melding- Fra: Paul Devine [mailto:[EMAIL PROTECTED] Sendt: 29. mars 2006 22:47 Til: user@struts.apache.org Emne: [Shale] commons client side validation not working inside a dataList I tried using the commons validation features of Shale. The application is using Myfaces 1.1.1. The validation javascript is being written back to the browser. The server side validation is working fine but a javascript `field error occurs during the . However there is a problem with the client side input element Id's that the javascript validation is looking for versus the client side id's that are generated by the dataList. The page i tried validation on has a Myfaces dataList inside a form, and for each iteration through the list there are inputs. Basically a dataList will append the `row index` to the client side Id to guarantee uniqueness, as in myForm:myDataList_0:someRequiredField for the first row, myForm:myDataList_1:someRequiredField for the second, and so on. But in the rendering of the javascript by the struts validatorScript tag, the clientId of the input components lose their row index. I have created an illustrative example that generates the same problem. The code is included below and the inline comments hopefully explain what's happening. To keep things simple there is no backing bean, and I use a class from shale-core to give me some objects to edit, so all you'd just need to deploy into a shale-core based blank web-app. My application page is more complex than this but I am running into exact the same problem withthe validation javascript Does this look familiar to anyone? Any workarounds, solutions?... Thanks -- Paul Devine %@ page language=java import=java.util.*, org.apache.shale.dialog.impl.DialogImpl% %@ taglib uri=http://java.sun.com/jsf/html; prefix=h % %@ taglib uri=http://java.sun.com/jsf/core; prefix=f % %@ taglib uri=http://myfaces.apache.org/extensions; prefix=t% %@ taglib uri=http://struts.apache.org/shale/core; prefix=s % % /* Put a couple of Shale DialogImpl objects into the session (we just need an object with a getter and a setter * and this class is readily accessible) */ List inputObjects = new ArrayList(); inputObjects.add(new DialogImpl()); inputObjects.add(new DialogImpl()); session.setAttribute(someInputObjects,inputObjects); % f:view %-- A form with a dataList of inputs. The client side id's of the components will be someForm:someDataList_0:someRequiredField and someForm:someDataList_1:someRequiredField --% h:form id=someForm onsubmit=return validateForm(this); t:dataList id=someDataList value=#{someInputObjects} var=object rowIndexVar=index h:outputLabel value=Name/ h:inputText id=someRequiredField value=#{object.name} size=20 required=true s:commonsValidator type=required arg=Name server=true client=true/ /h:inputTexth:message for=someRequiredField errorClass=errorMessage/ /t:dataList %-- The dataList is now closed. Before we close out the form, write out the validator javascript. But this results in a mismatch on the client side id's in the required function. Note the uniqueness indexes _0 and _1 are missing. Because we are outside the dataList there is no row index anymore (and for some reason the HtmlInputText components `calculate` their clientId's again when asked for getClientId from Shale's ValidatorScript findCommonsValidators method Here's what the validatorScript comes up with:- function required() { this[0] = new Array(someForm:someDataList:someRequiredField, Name is required., new Function(x, return {}[x];)); } --% s:validatorScript functionName=validateForm/ h:commandButton action=submit/ /h:form /f:view - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
SV: SV: [Shale] commons client side validation not working inside a dataList
Hi I seem to remember that this issue has come up on the myfaces list, and that the solution was to use forceId. Hermod -Opprinnelig melding- Fra: news [mailto:[EMAIL PROTECTED] På vegne av Laurie Harper Sendt: 30. mars 2006 00:07 Til: user@struts.apache.org Emne: Re: SV: [Shale] commons client side validation not working inside a dataList Why would that be needed? The s:commonsValidator tag should render Javascript referencing the actual rendered ID of the component it's attached to. I haven't played much with validators, much less validators for components inside dataLists, but I would have thought this should be able to work as it is. Paul, could you include your sample JSP and, if possible, copy/paste the rendered HTML as well, in a Bugzilla ticket so the issue gets tracked? L. Hermod Opstvedt wrote: Hi Did I hear forceId? - You need to use this attribute to force the name to be what you want. Hermod -Opprinnelig melding- Fra: Paul Devine [mailto:[EMAIL PROTECTED] Sendt: 29. mars 2006 22:47 Til: user@struts.apache.org Emne: [Shale] commons client side validation not working inside a dataList I tried using the commons validation features of Shale. The application is using Myfaces 1.1.1. The validation javascript is being written back to the browser. The server side validation is working fine but a javascript `field error occurs during the . However there is a problem with the client side input element Id's that the javascript validation is looking for versus the client side id's that are generated by the dataList. The page i tried validation on has a Myfaces dataList inside a form, and for each iteration through the list there are inputs. Basically a dataList will append the `row index` to the client side Id to guarantee uniqueness, as in myForm:myDataList_0:someRequiredField for the first row, myForm:myDataList_1:someRequiredField for the second, and so on. But in the rendering of the javascript by the struts validatorScript tag, the clientId of the input components lose their row index. I have created an illustrative example that generates the same problem. The code is included below and the inline comments hopefully explain what's happening. To keep things simple there is no backing bean, and I use a class from shale-core to give me some objects to edit, so all you'd just need to deploy into a shale-core based blank web-app. My application page is more complex than this but I am running into exact the same problem withthe validation javascript Does this look familiar to anyone? Any workarounds, solutions?... Thanks -- Paul Devine %@ page language=java import=java.util.*, org.apache.shale.dialog.impl.DialogImpl% %@ taglib uri=http://java.sun.com/jsf/html; prefix=h % %@ taglib uri=http://java.sun.com/jsf/core; prefix=f % %@ taglib uri=http://myfaces.apache.org/extensions; prefix=t% %@ taglib uri=http://struts.apache.org/shale/core; prefix=s % % /* Put a couple of Shale DialogImpl objects into the session (we just need an object with a getter and a setter * and this class is readily accessible) */ List inputObjects = new ArrayList(); inputObjects.add(new DialogImpl()); inputObjects.add(new DialogImpl()); session.setAttribute(someInputObjects,inputObjects); % f:view %-- A form with a dataList of inputs. The client side id's of the components will be someForm:someDataList_0:someRequiredField and someForm:someDataList_1:someRequiredField --% h:form id=someForm onsubmit=return validateForm(this); t:dataList id=someDataList value=#{someInputObjects} var=object rowIndexVar=index h:outputLabel value=Name/ h:inputText id=someRequiredField value=#{object.name} size=20 required=true s:commonsValidator type=required arg=Name server=true client=true/ /h:inputTexth:message for=someRequiredField errorClass=errorMessage/ /t:dataList %-- The dataList is now closed. Before we close out the form, write out the validator javascript. But this results in a mismatch on the client side id's in the required function. Note the uniqueness indexes _0 and _1 are missing. Because we are outside the dataList there is no row index anymore (and for some reason the HtmlInputText components `calculate` their clientId's again when asked for getClientId from Shale's ValidatorScript findCommonsValidators method Here's what the validatorScript comes up with:- function required() { this[0] = new Array(someForm:someDataList:someRequiredField, Name is required., new Function(x, return {}[x];)); } --% s:validatorScript functionName=validateForm/ h:commandButton action=submit/ /h:form /f:view - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED
Re: SV: [Shale] commons client side validation not working inside a dataList
From: Laurie Harper [EMAIL PROTECTED] Why would that be needed? The s:commonsValidator tag should render Javascript referencing the actual rendered ID of the component it's attached to. I haven't played much with validators, much less validators for components inside dataLists, but I would have thought this should be able to work as it is. I think this one is a bug. The dataList component is a naming container so any components contained in it, should get a clientId prefix from all naming containers that it's nested in. The dataList extends the UIData component who creates it's client id from the current row. public String getClientId(FacesContext context) { String clientId = super.getClientId(context); int rowIndex = getRowIndex(); if (rowIndex == -1) { return clientId; } else { return clientId + _ + rowIndex; } } The validator script collector asks the components with the commons validator for their client id after the dataList has done it's renderering which renderers it's own children. I want to say that JSF 1.2 adds a callback to handle this but I don't understand the details yet. Paul, please create a bugzilla ticket on this one. Gary Paul, could you include your sample JSP and, if possible, copy/paste the rendered HTML as well, in a Bugzilla ticket so the issue gets tracked? L. Hermod Opstvedt wrote: Hi Did I hear forceId? - You need to use this attribute to force the name to be what you want. Hermod -Opprinnelig melding- Fra: Paul Devine [mailto:[EMAIL PROTECTED] Sendt: 29. mars 2006 22:47 Til: user@struts.apache.org Emne: [Shale] commons client side validation not working inside a dataList I tried using the commons validation features of Shale. The application is using Myfaces 1.1.1. The validation javascript is being written back to the browser. The server side validation is working fine but a javascript `field error occurs during the . However there is a problem with the client side input element Id's that the javascript validation is looking for versus the client side id's that are generated by the dataList. The page i tried validation on has a Myfaces dataList inside a form, and for each iteration through the list there are inputs. Basically a dataList will append the `row index` to the client side Id to guarantee uniqueness, as in myForm:myDataList_0:someRequiredField for the first row, myForm:myDataList_1:someRequiredField for the second, and so on. But in the rendering of the javascript by the struts validatorScript tag, the clientId of the input components lose their row index. I have created an illustrative example that generates the same problem. The code is included below and the inline comments hopefully explain what's happening. To keep things simple there is no backing bean, and I use a class from shale-core to give me some objects to edit, so all you'd just need to deploy into a shale-core based blank web-app. My application page is more complex than this but I am running into exact the same problem withthe validation javascript Does this look familiar to anyone? Any workarounds, solutions?... Thanks -- Paul Devine rowIndexVar=index required=true client=true/ errorClass=errorMessage/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: SV: [Shale] commons client side validation not working inside a dataList
I will create the bug and attach the example code. Thanks for all your help. If anyone can think of a short term workaround, maybe even a javascript hack I can fit in myself, that would be great too :-) -- Paul On 3/29/06, Gary VanMatre [EMAIL PROTECTED] wrote: From: Laurie Harper [EMAIL PROTECTED] Why would that be needed? The s:commonsValidator tag should render Javascript referencing the actual rendered ID of the component it's attached to. I haven't played much with validators, much less validators for components inside dataLists, but I would have thought this should be able to work as it is. I think this one is a bug. The dataList component is a naming container so any components contained in it, should get a clientId prefix from all naming containers that it's nested in. The dataList extends the UIData component who creates it's client id from the current row. public String getClientId(FacesContext context) { String clientId = super.getClientId(context); int rowIndex = getRowIndex(); if (rowIndex == -1) { return clientId; } else { return clientId + _ + rowIndex; } } The validator script collector asks the components with the commons validator for their client id after the dataList has done it's renderering which renderers it's own children. I want to say that JSF 1.2 adds a callback to handle this but I don't understand the details yet. Paul, please create a bugzilla ticket on this one. Gary Paul, could you include your sample JSP and, if possible, copy/paste the rendered HTML as well, in a Bugzilla ticket so the issue gets tracked? L. Hermod Opstvedt wrote: Hi Did I hear forceId? - You need to use this attribute to force the name to be what you want. Hermod -Opprinnelig melding- Fra: Paul Devine [mailto:[EMAIL PROTECTED] Sendt: 29. mars 2006 22:47 Til: user@struts.apache.org Emne: [Shale] commons client side validation not working inside a dataList I tried using the commons validation features of Shale. The application is using Myfaces 1.1.1. The validation javascript is being written back to the browser. The server side validation is working fine but a javascript `field error occurs during the . However there is a problem with the client side input element Id's that the javascript validation is looking for versus the client side id's that are generated by the dataList. The page i tried validation on has a Myfaces dataList inside a form, and for each iteration through the list there are inputs. Basically a dataList will append the `row index` to the client side Id to guarantee uniqueness, as in myForm:myDataList_0:someRequiredField for the first row, myForm:myDataList_1:someRequiredField for the second, and so on. But in the rendering of the javascript by the struts validatorScript tag, the clientId of the input components lose their row index. I have created an illustrative example that generates the same problem. The code is included below and the inline comments hopefully explain what's happening. To keep things simple there is no backing bean, and I use a class from shale-core to give me some objects to edit, so all you'd just need to deploy into a shale-core based blank web-app. My application page is more complex than this but I am running into exact the same problem withthe validation javascript Does this look familiar to anyone? Any workarounds, solutions?... Thanks -- Paul Devine rowIndexVar=index required=true client=true/ errorClass=errorMessage/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]