Re: SV: [Shale] commons client side validation not working inside a dataList
From: Paul Devine [EMAIL PROTECTED] 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 :-) I can't think of a quick fix since each UIInput component would need to capture it's clientId in the renderer and stuff it back into the component's attributes for the validator script collector. component.getAttributes().put(org.apache.shale.validator.clientId, component.getClentId(facesContext); We might be able to solve this problem globally using a propose renderer decorator (http://issues.apache.org/bugzilla/show_bug.cgi?id=37932). Gary -- Paul On 3/29/06, Gary VanMatre wrote: From: Laurie Harper 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]
Client Side Validation
Anyone have an example of using client side validation with a DynaValidatorActionForm ? I see no examples in here http://struts.apache.org//struts-doc-1.2.8/userGuide/dev_validator.html and while the javascript tag descrption is thorough: (http://struts.apache.org//struts-doc-1.2.8/userGuide/struts-html.html#javascript) I find it sort of useless outside of context. I am using the path attribute as the key in my validation.xml The form associated with the action is a DynaValidatorActionForm. html:form action = /FooLookupAction onsubmit=return validatefooLookupAction(this) // stuff here /html:form html:javascript formName=LookupAction / now I realize this syntax must be very wrong because I'm getting: ServletException: No form found under 'FooLookupAction' in locale 'en_US' I know that it is done one way if you use a normal ActionForm for and another way for DynaValidator* . I'm piuzzled as to why usage examples on the various permutations of client side validation have not yet slipped into the docs after all these years. Thanks in advance. Vinny -- Ghetto Java: http://www.ghettojava.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Client Side Validation
The MailReader application for 1.3 uses DynaValidatorForm's. You could change those to DynaValidatorActionForm to test the syntax changes. * http://svn.apache.org/dist/struts/apps/v1.3.0/ HTH, Ted. On 3/21/06, Vinny [EMAIL PROTECTED] wrote: Anyone have an example of using client side validation with a DynaValidatorActionForm ? I see no examples in here http://struts.apache.org//struts-doc-1.2.8/userGuide/dev_validator.html and while the javascript tag descrption is thorough: (http://struts.apache.org//struts-doc-1.2.8/userGuide/struts-html.html#javascript) I find it sort of useless outside of context. I am using the path attribute as the key in my validation.xml The form associated with the action is a DynaValidatorActionForm. html:form action = /FooLookupAction onsubmit=return validatefooLookupAction(this) // stuff here /html:form html:javascript formName=LookupAction / now I realize this syntax must be very wrong because I'm getting: ServletException: No form found under 'FooLookupAction' in locale 'en_US' I know that it is done one way if you use a normal ActionForm for and another way for DynaValidator* . I'm piuzzled as to why usage examples on the various permutations of client side validation have not yet slipped into the docs after all these years. Thanks in advance. Vinny -- Ghetto Java: http://www.ghettojava.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- HTH, Ted. ** http://www.husted.com/ted/blog/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Client Side Validation
Also, you'll need to move the html:javascript tag inside the html:form tag. The reason you're getting an error looking up the form bean is because it only exists within the scope of html:form tag. Note that this requirement is generally true for form-based tag in the html taglib. L. Ted Husted wrote: The MailReader application for 1.3 uses DynaValidatorForm's. You could change those to DynaValidatorActionForm to test the syntax changes. * http://svn.apache.org/dist/struts/apps/v1.3.0/ HTH, Ted. On 3/21/06, Vinny [EMAIL PROTECTED] wrote: Anyone have an example of using client side validation with a DynaValidatorActionForm ? I see no examples in here http://struts.apache.org//struts-doc-1.2.8/userGuide/dev_validator.html and while the javascript tag descrption is thorough: (http://struts.apache.org//struts-doc-1.2.8/userGuide/struts-html.html#javascript) I find it sort of useless outside of context. I am using the path attribute as the key in my validation.xml The form associated with the action is a DynaValidatorActionForm. html:form action = /FooLookupAction onsubmit=return validatefooLookupAction(this) // stuff here /html:form html:javascript formName=LookupAction / now I realize this syntax must be very wrong because I'm getting: ServletException: No form found under 'FooLookupAction' in locale 'en_US' I know that it is done one way if you use a normal ActionForm for and another way for DynaValidator* . I'm piuzzled as to why usage examples on the various permutations of client side validation have not yet slipped into the docs after all these years. Thanks in advance. Vinny -- Ghetto Java: http://www.ghettojava.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- HTH, Ted. ** http://www.husted.com/ted/blog/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Client-Side validation
Hi, I try to use client-side validation in struts. but I have a problem. I have a actionform which I want to verify, in my first jsp some fields of the form is shown say username, usersurname,email, and in some other jsp other fields should be checked say gender. address..etc. I could not define validation rules for that sutiation, is there a way to define rule in that condition, except define 2 form.
newbie question on client-side validation
Hello, I am having trouble creating the client-side JavaScript for a custom validator. Basically, the validator checks if the user input matches one of a set of 3 strings. I've written the server-side code but need help with the JavaScript. I have looked at the standard validator-rules.xml file for examples, but I still have questions. For example, the validateMask function creates a new Mask object, but I don't see where this constructor is located and what exactly it does. I've searched for documentation on this topic, but all materials I've found have glossed over the topic. Could someone give me a brief explanation or point me to one? thanks, Jennifer - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Client side validation broken when using DynaValidatorActionForm.
David, Many thanks. -Miles -Original Message- From: David G. Friedman [mailto:[EMAIL PROTECTED] Sent: 25 November 2004 17:49 To: Struts Users Mailing List Subject: RE: Client side validation broken when using DynaValidatorActionForm. Miles, Validation based on actions has that slash-in-the-name related problem. You can specify a name for the validation method using the html:javascript attribute method= Just be sure to change your html:form's onsubmit to invoke that new method name. For example: html:javascript formName=/someActionName method=validateForm / html:form action=... ... onsubmit=return(validateForm(this)); Just use the name validateForm or change it to any valid JavaScript method name of your choice. For more details see: http://forum.java.sun.com/thread.jspa?forumID=45messageID=267 4439threadID= 548445 http://homepage2.nifty.com/ymagic/struts/OtherTranslate/Struts Validator/jspt ags-jp.html Regards, David -Original Message- From: Daffin, Miles (Company IT) [mailto:[EMAIL PROTECTED] Sent: Thursday, November 25, 2004 11:38 AM To: Struts Users Mailing List Subject: Client side validation broken when using DynaValidatorActionForm. Hi All, Apologies if this one has already been covered (I searched the list). I am using struts 1.1 with one DynaValidatorActionForm for holding data from multiple jsp forms (wizard style reg form). The server side validation works fine but the generated javascript is broken. The name of the form validating function is taken directly from the form name attribute in the form-validation formset (validation.xml), and this contains '/' characters because it is the path to the relevant action. Is this a bug, or am I misusing/misunderstanding something? Thanks. -Miles Miles Daffin Morgan Stanley 20 Cabot Square | Canary Wharf | London E14 4QA | UK Tel: +44 (0) 20 767 75119 [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] NOTICE: If received in error, please destroy and notify sender. Sender does not waive confidentiality or privilege, and use is prohibited. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] NOTICE: If received in error, please destroy and notify sender. Sender does not waive confidentiality or privilege, and use is prohibited. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Client side validation broken when using DynaValidatorActionForm.
Hi All, Apologies if this one has already been covered (I searched the list). I am using struts 1.1 with one DynaValidatorActionForm for holding data from multiple jsp forms (wizard style reg form). The server side validation works fine but the generated javascript is broken. The name of the form validating function is taken directly from the form name attribute in the form-validation formset (validation.xml), and this contains '/' characters because it is the path to the relevant action. Is this a bug, or am I misusing/misunderstanding something? Thanks. -Miles Miles Daffin Morgan Stanley 20 Cabot Square | Canary Wharf | London E14 4QA | UK Tel: +44 (0) 20 767 75119 [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] NOTICE: If received in error, please destroy and notify sender. Sender does not waive confidentiality or privilege, and use is prohibited.
RE: Client side validation broken when using DynaValidatorActionForm.
Miles, Validation based on actions has that slash-in-the-name related problem. You can specify a name for the validation method using the html:javascript attribute method= Just be sure to change your html:form's onsubmit to invoke that new method name. For example: html:javascript formName=/someActionName method=validateForm / html:form action=... ... onsubmit=return(validateForm(this)); Just use the name validateForm or change it to any valid JavaScript method name of your choice. For more details see: http://forum.java.sun.com/thread.jspa?forumID=45messageID=2674439threadID= 548445 http://homepage2.nifty.com/ymagic/struts/OtherTranslate/StrutsValidator/jspt ags-jp.html Regards, David -Original Message- From: Daffin, Miles (Company IT) [mailto:[EMAIL PROTECTED] Sent: Thursday, November 25, 2004 11:38 AM To: Struts Users Mailing List Subject: Client side validation broken when using DynaValidatorActionForm. Hi All, Apologies if this one has already been covered (I searched the list). I am using struts 1.1 with one DynaValidatorActionForm for holding data from multiple jsp forms (wizard style reg form). The server side validation works fine but the generated javascript is broken. The name of the form validating function is taken directly from the form name attribute in the form-validation formset (validation.xml), and this contains '/' characters because it is the path to the relevant action. Is this a bug, or am I misusing/misunderstanding something? Thanks. -Miles Miles Daffin Morgan Stanley 20 Cabot Square | Canary Wharf | London E14 4QA | UK Tel: +44 (0) 20 767 75119 [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] NOTICE: If received in error, please destroy and notify sender. Sender does not waive confidentiality or privilege, and use is prohibited. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
client-side validation javascript error
Hi, I'm trying to get client-side validation to work using Struts, v. 1.2.2. More specifically, I'm receiving a javascript error while trying to use the 'required' validation rule. The error in IE says: Error: 'required' is undefined When I look at the generated javascript, this is indeed true. However, there's a function called 'locationForm_required' where 'locationForm' is the name of my form. It seems that the 'validateRequired' method should be calling a 'new locationForm_required( )' instead of a 'new required( ). function locationForm_required () { this.a0 = new Array(shortDescription, Short Description is required., new Function (varName, return this[varName];)); } 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]]; ... blah blah Does anyone have any insight into this? Thanks in advance, Jeff - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: client-side validation javascript error
Version 1.2.2 of Struts was withdrawn because of problems. The current ga quality release of Struts is Version 1.2.4 http://struts.apache.org/acquiring.html Niall - Original Message - From: Jeffrey Ford [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, October 26, 2004 5:52 PM Subject: client-side validation javascript error Hi, I'm trying to get client-side validation to work using Struts, v. 1.2.2. More specifically, I'm receiving a javascript error while trying to use the 'required' validation rule. The error in IE says: Error: 'required' is undefined When I look at the generated javascript, this is indeed true. However, there's a function called 'locationForm_required' where 'locationForm' is the name of my form. It seems that the 'validateRequired' method should be calling a 'new locationForm_required( )' instead of a 'new required( ). function locationForm_required () { this.a0 = new Array(shortDescription, Short Description is required., new Function (varName, return this[varName];)); } 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]]; ... blah blah Does anyone have any insight into this? Thanks in advance, Jeff - 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]
Enhanced client side validation
We have a requirement to validate (using Javascript) beans whose properties can be of type Map, List, [], or any simple type. Furthermore, Maps, Lists, and []s can be arbitrarily nested. We have found that the validator only supports simple properties (on the client). We modified it last year to support Lists and []s. Now we want to modify it to support Maps and nesting. Here's how it currently works: Suppose a user has a List of addresses: public class User { public List getAddresses() { ... } } and an address has a zip: public class Address { public String getZip() { ... } } So in validation.xml we write: form name=user field property=zip indexedListProperty=addresses ... What we would rather do is write: form name=user field property=addresses.zip ... or field property=addresses[].zip ... Then we can expand this to support nesting and Maps: !-- validates all areaCodes -- field property=addresses[].phoneNumbers[].areaCode ... !-- addresses is of type Map now; validates areaCodes for shipping address -- field property=addresses(shipping).phoneNumbers[].areaCode ... field !-- validates all areaCodes -- property=addresses().phoneNumbers[].areaCode ... field !-- validates areaCodes for shipping address and phone numbers that start with home (i.e. home, home1, home2, etc.) -- field property=addresses(shipping).phoneNumbers(home*).areaCode ... Note the wildcard in the last example. Please let us know if this has been done before; if there's a better approach; or if you would like the code for yourself. Thanks, Mike Dunn mike dot dunn at siemens dot com
Client Side Validation using a pure JSF Only Application
Hi All, There is a pure web application that uses only jsf as model, view, controller. How do we achieve a reusable client-side validations framework likes Struts's validator framework ? Any ideas on how we do a clientside validation in a pure jsf application ? Thanks Regards, Kumar. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Client Side Validation using a pure JSF Only Application
Hi, Download the sources from this site http://horstmann.com/corejsf/ In ch12 you can find examples for generating the client side javascript code for performing the client side validations. Regards, KP -Original Message- From: babloosony [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 29, 2004 3:27 PM To: Struts Users Mailing List; [EMAIL PROTECTED] Subject: Client Side Validation using a pure JSF Only Application Hi All, There is a pure web application that uses only jsf as model, view, controller. How do we achieve a reusable client-side validations framework likes Struts's validator framework ? Any ideas on how we do a clientside validation in a pure jsf application ? Thanks Regards, Kumar. - 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 using a pure JSF Only Application
Check out the Oracle Faces components set which you can get an Early Access version of from: http://www.oracle.com/technology/products/jdev/htdocs/partners/addins/exchange/jsf/index.html This implemenation has client side validators built-in Regards Duncan Mills babloosony wrote: Hi All, There is a pure web application that uses only jsf as model, view, controller. How do we achieve a reusable client-side validations framework likes Struts's validator framework ? Any ideas on how we do a clientside validation in a pure jsf application ? Thanks Regards, Kumar. - 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 using struts in a jsf+struts integrated application
On Fri, 24 Sep 2004 11:38:56 +0530, babloosony [EMAIL PROTECTED] wrote: Hi All, How do I do client side validation(using struts) in jsf+struts integrated application which uses jsf-struts libary provided by CraigMc. ? You enable client side validation with Struts+JSF the same way you do in a standalone Struts based application -- by adding an onsubmit hander to the form tag, and an appropriate JavaScript tag to include the actual validation methods. Both of the examples included with the Struts+JSF library have client side JavaScript enabled. Thanks Regards, Kumar. Craig - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
client side validation using struts in a jsf+struts integrated application
Hi All, How do I do client side validation(using struts) in jsf+struts integrated application which uses jsf-struts libary provided by CraigMc. ? Thanks Regards, Kumar. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validation problem - form still submits after client-side validation fails.
You do not need to submit the form if you are using an input type=image. That's what it does if it is pressed (unless the image is outside of the form.../form tags. Make sure your html:form has the proper onsubmit=return validateXYZForm() (notice that 'return' will stop the page from submitting if validation fails), just calling validateXYZForm() will still allow the request to continue in most browsers. (this will look a little different depending on which incarnation you are using ValidatorForm/ValidatorActionForm (with or without Dyna) ) form action=/myAction onsubmit=return validateXYZForm() ... ... html:image onclick=document.forms[0].Dispatch.value='Save'; page=/images/btn_primary_action_save.gif align=right onmouseover=src='/images/btn_primary_action_save_roll.gif' onmouseout=src='/images/btn_primary_action_save.gif'/ html:javascript dynamicJavascript=true staticJavascript=false formName=/myAction method=validateXYZForm/ /form -- James Mitchell Software Engineer / Open Source Evangelist EdgeTech, Inc. 678.910.8017 AIM: jmitchtx - Original Message - From: [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Monday, September 20, 2004 5:42 PM Subject: Re: Validation problem - form still submits after client-side validat ion fails. If I'm understanding your scenario correctly your onclick needs to call a function that will call the submit() on the form only if the validation passes. Barnett, Brian W. [EMAIL PROTECTED] wrote on 09/20/2004 04:51:55 PM: Both the client-side and the server-side validation are executing instead of just the client-side. I know it has something to do with the way I've coded the save button. The underlying problem is that I want to use images and roll-over images for the save button but I also want the enter key to submit the form. Here is the save button code in the jsp: input type=image onclick=document.forms[0].Dispatch.value='Save';document.forms[0].submit(); src=/images/btn_primary_action_save.gif align=right onmouseover=src='/images/btn_primary_action_save_roll.gif' onmouseout=src='/images/btn_primary_action_save.gif'/ The roll-over images works, and the enter key works but it looks like the form still gets submitted after client-side validation fails. Does anyone know how to prevent that and still maintain images and enter key functionality? Thanks, Brian Barnett - 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]
Toomany Client-side validation code!!!
Hai all when we use Struts Validator in client side, it creates too big and many unwanted functions in the client side, is it possible to reduce or copy all javascript functioins into .js file and attach them so client dont want to read too much codes ? any solution there in Struts 1.1 Thanks, Rajesh - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Toomany Client-side validation code!!!
Hi Rajesh, when we use Struts Validator in client side, it creates too big and many unwanted functions in the client side, is it possible to reduce or copy all javascript functioins into .js file and attach them so client dont want to read too much codes ? Take a look at http://struts.apache.org/userGuide/struts-html.html#javascript 2nd paragraph gives you the answer. Best regards, -- Shinobu Kawai -- Shinobu Kawai [EMAIL PROTECTED], [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Toomany Client-side validation code!!!
Hai you mean dynamicJavascript=false what will happen if i give it. normally html:javascript will create a main function called validateformname(form) {} will this function writes ? if so then where all the other functions goes ? Rajesh Shinobu Kawai wrote: Hi Rajesh, when we use Struts Validator in client side, it creates too big and many unwanted functions in the client side, is it possible to reduce or copy all javascript functioins into .js file and attach them so client dont want to read too much codes ? Take a look at http://struts.apache.org/userGuide/struts-html.html#javascript 2nd paragraph gives you the answer. Best regards, -- Shinobu Kawai -- Shinobu Kawai [EMAIL PROTECTED], [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]
Problem in Client Side Validation in Struts
Dear Sir, I have a problem in Client Side Validation in Struts 1.1.Actually see what is happening and what i have done: I have written all validdation and validation rules invalidator.xml and valation-rule.xml. I have given path (through plug-in tag) in struts-config file. \ I have called it in JSP's by using return validateFormName onsubmit of the Form. Its working properly when I left the any required (of which validation ihave given in Validator.xml file)field blank. But it is not working when I'm doing validation of Maxlength and minlength of fields? It is not generating any error but doesn't working also. WHy i'm getting such a problem. Hope you will undersatnd it and will reply me. Thanks and Reagrds, Sandip Mante "The Journy has been started and the sky is limit !!!" "Failure always made me try harder next time!!!" Sandip K. ManteSoftware Engineer Penta Computing Pvt. LtdShivaji Nagar,Pune-411004 [EMAIL PROTECTED] mobile: +919822859361 Signature powered by Plaxo Want a signature like this? Add me to your address book... Penta.bmp
RE: Problem in Client Side Validation in Struts
The form should have an onSubmit setting to invoke that javascript function. Have you assured that the web page you see in the browser: a) has the onsubmit listing your validation form function b) has the require() javascript function c) has the form named javascript function d) isn't showing any javascript error messages. Regards, David -Original Message- From: Sandip Mante [mailto:[EMAIL PROTECTED] Sent: Saturday, June 05, 2004 12:33 AM To: [EMAIL PROTECTED] Subject: Problem in Client Side Validation in Struts Dear Sir, I have a problem in Client Side Validation in Struts 1.1.Actually see what is happening and what i have done: I have written all validdation and validation rules invalidator.xml and valation-rule.xml. I have given path (through plug-in tag) in struts-config file. \ I have called it in JSP's by using return validateFormName onsubmit of the Form. Its working properly when I left the any required (of which validation ihave given in Validator.xml file)field blank. But it is not working when I'm doing validation of Maxlength and minlength of fields? It is not generating any error but doesn't working also. WHy i'm getting such a problem. Hope you will undersatnd it and will reply me. Thanks and Reagrds, Sandip Mante The Journy has been started and the sky is limit !!! Failure always made me try harder next time!!! Sandip K. Mante Software Engineer Penta Computing Pvt. Ltd Shivaji Nagar, Pune-411004 [EMAIL PROTECTED] mobile: +919822859361 Signature powered by PlaxoWant a signature like this? Add me to your address book... - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Multiple ActionForms on a page - client side validation possible?
Hi, I have a page that logically subdivides into 3 independent HTML forms and I've subsequently planned on using 3 different ValidatorForms for each. There seems to be no problem in configuring validations for each form's fields and having those validations trigger from the server side. However, I seem to be running into problems when trying to activiate client side validation via multiple html:javascript tags. To simplify things, I've only configured two ActionForms each of which has a property that uses the required validator. The tags in my JSP (in the HTML head) look like this: html:javascript formName=form1 staticJavascript=false dynamicJavascript=true / html:javascript formName=form2 staticJavascript=false dynamicJavascript=true / html:javascript formName=form1 staticJavascript=true dynamicJavascript=false / The problem seems to be that each of the dynamic JS tags emits a required() method that is not name-specific to its form. This results in the second such definition being the only one that is visible from the entire page. Therefore, the form2 does correctly perform client-side validation for its required field whereas form1 does not. Is there a correct way to make this work? Merging everything into one big unwieldy form would work, but would make the data structures unmanageable. Wayne - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Multiple ActionForms on a page - client side validation possible?
http://issues.apache.org/bugzilla/show_bug.cgi?id=17667 try the latest nightly build. Niall - Original Message - From: Berke, Wayne [IT] [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, April 20, 2004 5:26 PM Subject: Multiple ActionForms on a page - client side validation possible? Hi, I have a page that logically subdivides into 3 independent HTML forms and I've subsequently planned on using 3 different ValidatorForms for each. There seems to be no problem in configuring validations for each form's fields and having those validations trigger from the server side. However, I seem to be running into problems when trying to activiate client side validation via multiple html:javascript tags. To simplify things, I've only configured two ActionForms each of which has a property that uses the required validator. The tags in my JSP (in the HTML head) look like this: html:javascript formName=form1 staticJavascript=false dynamicJavascript=true / html:javascript formName=form2 staticJavascript=false dynamicJavascript=true / html:javascript formName=form1 staticJavascript=true dynamicJavascript=false / The problem seems to be that each of the dynamic JS tags emits a required() method that is not name-specific to its form. This results in the second such definition being the only one that is visible from the entire page. Therefore, the form2 does correctly perform client-side validation for its required field whereas form1 does not. Is there a correct way to make this work? Merging everything into one big unwieldy form would work, but would make the data structures unmanageable. Wayne - 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: DynaValidatorActionForm client-side validation
I may be a little off here, but why are you using the DynaValidatorActionForm ? Try using the DynaValidatorForm and u should have client-side and server-side validation working. This is because, the DynaValidatorActionForm.getValidationKey returns the mapping PATH, whereas the DynaValidatorForm.getValidationKey returns the mapping NAME! HTH, KP -Original Message- From: Saul Q Yuan [mailto:[EMAIL PROTECTED] Sent: Friday, 9 April 2004 06:03 To: 'Struts Users Mailing List' Subject: RE: DynaValidatorActionForm client-side validation Hmmm, I don't seem to have that problem. Did you specify method=validateYourActionForm in addition to: formName=/yourActionPath in your html:javascript tag? If so, the js function generated will be validateYourActionForm. I could be wrong, but don't have time now to dig deep into the code. HTH, Saul -Original Message- From: Adam Hardy [mailto:[EMAIL PROTECTED] Sent: Thursday, April 08, 2004 3:02 PM To: Struts Users Mailing List Subject: Re: DynaValidatorActionForm client-side validation Hmmm, good question. I had this problem, but never managed to solve it. I thought I was doing something wrong but I couldn't work it out. Eventually I changed to DynaValidatorForm, which wasn't a big problem because there were only 2 or 3 forms where I wanted to use the same DynaForm but different validation. Perhaps someone actually knows if there is a solution? On 04/08/2004 11:16 AM Igor Antonacci wrote: Hi All, I'm working on DynaValidatorActionForm client-side validation but I've some problems about. Everything is working but, as DynaValidatorActionForm maps validation rules with Action path attribute, Struts generates a client side validation method name with a / character. It is because Action path has a / as first character. How do I solve this issue ? Thanks, Igor. -- Callidus Software Igor Antonacci Core Engineer [EMAIL PROTECTED] -- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- struts 1.2 + tomcat 5.0.19 + java 1.4.2 Linux 2.4.20 Debian - 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: DynaValidatorActionForm client-side validation
Yes I know, and it's for a reason. DynaValidatorActionForm doesn't exist by chance. Regarding the javascript function names, it's not the main validation function name that's the problem - it's the secondary functions which instantiate the arrays for the different validations, e.g. surveyForm_required(), surveyForm_IntegerValidations(), surveyForm_DateValidations() Under ValidatorActionForm, they become /esurvey/survey/update_required() etc which are invalid. If nobody says anything different, I'm going to log this as a bug, if it's not there already. I'm not sure why, but I've just realised this thread was going to both user and dev lists, which is totally unnecessary! I'm just sending this reply to user. On 04/09/2004 08:43 AM Kunal H. Parikh wrote: I may be a little off here, but why are you using the DynaValidatorActionForm ? Try using the DynaValidatorForm and u should have client-side and server-side validation working. This is because, the DynaValidatorActionForm.getValidationKey returns the mapping PATH, whereas the DynaValidatorForm.getValidationKey returns the mapping NAME! HTH, KP -Original Message- From: Saul Q Yuan [mailto:[EMAIL PROTECTED] Sent: Friday, 9 April 2004 06:03 To: 'Struts Users Mailing List' Subject: RE: DynaValidatorActionForm client-side validation Hmmm, I don't seem to have that problem. Did you specify method=validateYourActionForm in addition to: formName=/yourActionPath in your html:javascript tag? If so, the js function generated will be validateYourActionForm. I could be wrong, but don't have time now to dig deep into the code. HTH, Saul -Original Message- From: Adam Hardy [mailto:[EMAIL PROTECTED] Sent: Thursday, April 08, 2004 3:02 PM To: Struts Users Mailing List Subject: Re: DynaValidatorActionForm client-side validation Hmmm, good question. I had this problem, but never managed to solve it. I thought I was doing something wrong but I couldn't work it out. Eventually I changed to DynaValidatorForm, which wasn't a big problem because there were only 2 or 3 forms where I wanted to use the same DynaForm but different validation. Perhaps someone actually knows if there is a solution? On 04/08/2004 11:16 AM Igor Antonacci wrote: Hi All, I'm working on DynaValidatorActionForm client-side validation but I've some problems about. Everything is working but, as DynaValidatorActionForm maps validation rules with Action path attribute, Struts generates a client side validation method name with a / character. It is because Action path has a / as first character. How do I solve this issue ? Thanks, Igor. -- Callidus Software Igor Antonacci Core Engineer [EMAIL PROTECTED] -- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- struts 1.2 + tomcat 5.0.19 + java 1.4.2 Linux 2.4.20 Debian - 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] -- struts 1.2 + tomcat 5.0.19 + java 1.4.2 Linux 2.4.20 Debian - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: DynaValidatorActionForm client-side validation
A patch recently went into the various flavours of validator forms which split out the logic which determines the validation key into a separate method - so if you look at the current versions of either ValidatorActionForm or DynaValidatorActionForm - they now only contain a very simple getValidationKey(request, mapping) method. http://cvs.apache.org/viewcvs.cgi/jakarta-struts/src/share/org/apache/struts/validator/ I use a version of DynaValidatorActionForm which removes the leading / - for Adam's problem (where he has /esurvey/survey/update) he could do that and replace the other slashes with underscores: public class MyDynaValidatorActionForm extends DynaValidatorForm implements DynaBean, Serializable { public String getValidationKey(ActionMapping mapping, HttpServletRequest request) { mapping.getPath().substring(1).replace('/', '_'); } } Then, in validation.xml formset form name=esurvey_survey_update field .. /form and on the jsp page: html:javascript formName=esurvey_survey_update/ If you can't use the latest build of struts, then copy the validate() method which calls getValidationKey() - when the next proper release of struts comes out, you can then delete the validate() method just leaving getValidationKey(). Niall - Original Message - From: Adam Hardy [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Thursday, April 08, 2004 8:02 PM Subject: Re: DynaValidatorActionForm client-side validation Hmmm, good question. I had this problem, but never managed to solve it. I thought I was doing something wrong but I couldn't work it out. Eventually I changed to DynaValidatorForm, which wasn't a big problem because there were only 2 or 3 forms where I wanted to use the same DynaForm but different validation. Perhaps someone actually knows if there is a solution? On 04/08/2004 11:16 AM Igor Antonacci wrote: Hi All, I'm working on DynaValidatorActionForm client-side validation but I've some problems about. Everything is working but, as DynaValidatorActionForm maps validation rules with Action path attribute, Struts generates a client side validation method name with a / character. It is because Action path has a / as first character. How do I solve this issue ? Thanks, Igor. -- Callidus Software Igor Antonacci Core Engineer [EMAIL PROTECTED] -- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- struts 1.2 + tomcat 5.0.19 + java 1.4.2 Linux 2.4.20 Debian - 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]
[SOLVED} RE: DynaValidatorActionForm client-side validation
Hi, I solved with your advice. Thanks a lot! Igor. -Original Message- From: Saul Q Yuan [mailto:[EMAIL PROTECTED] Sent: Thursday, April 08, 2004 10:03 PM To: 'Struts Users Mailing List' Subject: RE: DynaValidatorActionForm client-side validation Hmmm, I don't seem to have that problem. Did you specify method=validateYourActionForm in addition to: formName=/yourActionPath in your html:javascript tag? If so, the js function generated will be validateYourActionForm. I could be wrong, but don't have time now to dig deep into the code. HTH, Saul - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
DynaValidatorActionForm client-side validation
Hi All, I'm working on DynaValidatorActionForm client-side validation but I've some problems about. Everything is working but, as DynaValidatorActionForm maps validation rules with Action path attribute, Struts generates a client side validation method name with a / character. It is because Action path has a / as first character. How do I solve this issue ? Thanks, Igor. -- Callidus Software Igor Antonacci Core Engineer [EMAIL PROTECTED] -- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]