Re: Struts 1.3.5 and URL Validation
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Pushkar, [EMAIL PROTECTED] wrote: Yes, I was expecting client-side validation to work for URLs. And ya, other validations like required, email, maxlength..etc are working fine on this form. There was a bug in URLValidator that made it fail for even simple URLs like http://www.google.com, so I had to dump it and use a regular expression mask instead. (The URLValidator has since been patched and works fine). Since javascript can easily do regular expressions, you can use this regular expression to check your URLs. I went through the HTTP URL specification and attempted to include everything I could see for the regexp. The only problem is that it allows any protocol, even fictional ones (like joke://abc.com/). (Yes, this is a very long regular expression. Hopefully, it will come out on one line). ^[a-zA-Z][a-zA-Z0-9\+\-\.]*:(//(([a-zA-Z0-9\-_\.!~\*'\(\)%;:\+\$,]*@)?(([a-zA-Z0-9][a-zA-Z0-9-]*\.)*[a-zA-Z][a-zA-Z0-9]*|[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)(:[0-9]+)?)(/[a-zA-Z0-9\-_\.!~\*'\(\)%:@=\+\$,]*(;[a-zA-Z0-9\-_\.!~\*'\(\)%:@=\+\$,]*)*(/[a-zA-Z0-9\-_\.!~\*'\(\)%:@=\+\$,]*(;[a-zA-Z0-9\-_\.!~\*'\(\)%:@=\+\$,]*)*)*)?)(\?[;/\?:@=\+\$,a-zA-Z0-9\-_\.!~\*'\(\)%]+)?$ - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.6 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFFwMzF9CaO5/Lv0PARAsdjAJ0W+zKn2BMmqCzfCNgXfIKcDpld2wCfZzUu 79SZk6zCam4Na9xhGuA6V0E= =w1MJ -END PGP SIGNATURE- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Struts 1.3.5 and URL Validation
Hi everyone, I'm using Struts version 1.3.5 and I intend to use URL validation for a field using the validation.xml file. But, when I declare the field in validation.xml, it does not validate the field to check whether the URL is a valid one, meaning that it takes any input that I give in that textbox. Here's the entry from my validation.xml file: field property=vendorURL depends=url arg key=form.vendor.VendorURL position=0/ /field Is there anything else that I need to do for URL validation besides declaring in validation.xml? Regards, Pushkar.
Re: Struts 1.3.5 and URL Validation
--- [EMAIL PROTECTED] wrote: Is there anything else that I need to do for URL validation besides declaring in validation.xml? You need to provide more information. ActionForm class, how you're mapping from action = validation (bean name or action name), does any *other* validation on the same page work, etc. Dave Don't get soaked. Take a quick peak at the forecast with the Yahoo! Search weather shortcut. http://tools.search.yahoo.com/shortcuts/#loc_weather - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts 1.3.5 and URL Validation
On 1/30/07, Dave Newton [EMAIL PROTECTED] wrote: --- [EMAIL PROTECTED] wrote: Is there anything else that I need to do for URL validation besides declaring in validation.xml? You need to provide more information. ActionForm class, how you're mapping from action = validation (bean name or action name), does any *other* validation on the same page work, etc. Also are you expecting the client side validation to work for this? There is no client URL validation - only sever side. Niall P.S. The struts-examples webapp shipped with 1.3.5 has a type validator form that includes a URL validated field. Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Struts 1.3.5 and URL Validation
Yes, I was expecting client-side validation to work for URLs. And ya, other validations like required, email, maxlength..etc are working fine on this form. Thanks. -Pushkar -Original Message- From: Niall Pemberton [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 30, 2007 9:11 PM To: Struts Users Mailing List Subject: Re: Struts 1.3.5 and URL Validation On 1/30/07, Dave Newton [EMAIL PROTECTED] wrote: --- [EMAIL PROTECTED] wrote: Is there anything else that I need to do for URL validation besides declaring in validation.xml? You need to provide more information. ActionForm class, how you're mapping from action = validation (bean name or action name), does any *other* validation on the same page work, etc. Also are you expecting the client side validation to work for this? There is no client URL validation - only sever side. Niall P.S. The struts-examples webapp shipped with 1.3.5 has a type validator form that includes a URL validated field. Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]