Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Bypass client-side struts validation

Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I found many topics related to bypassing struts validation, but they dealt with server-side validation. I have a query reg. client-side validation

I have a form with around 10 fields. I have enabled client-side validation in Struts by specification in validator-rules.xml. I have two submit buttons, which I process at the backend using LookupDispatchAction. Now, only when I click one submit, I want the validator to validate the 10 fields. If I click other submit button, the the validation shouldn't happen. How to achieve it?

Please help. Thanks in advance.
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd suggest using the <html:cancel> tag to render the button that bypasses validation. This is still a submit button, but it just tells Struts not to process validation when it is pressed (Both server-side and client-side). If you write a method named cancelled in your DispatchAction, it will be called when the cancel button is pressed. Also note that if you're using Struts 1.2.9 or above, you must specify cancellable="true" in the Action mapping.
[ June 20, 2008: Message edited by: Merrill Higginson ]
Today you are you, that is turer than true. There is no one alive who is youer than you! - Seuss. Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic