• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Conditional form validation

 
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
On a page with a form on it, I have two submit buttons, one button does not validate the form and the other button does. Is it possible to simulate this?
 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The only work-around I found was to create a simple button that when it was pressed would call the action directly.

For example:
(syntax may not be correct but it will give you the idea)
< input type="button" onKlick="window='youraction.do'" >

this will bypass the validator and call another action.

Its not the best way but a work around for now.
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There is a mechanism in javascript for disabling the javascript validation. I don't remember the specifics, but if you code an <html:cancel/> or <html:reset/> button, you can find out. Just use your browser's "view source" function to look at the rendered version of the html, and you will see how it's done. Once you've learned the process, you can remove the <html:cancel> buttton and apply the same process to your button.
 
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
why don't you use LookupDispatchAction for multiple buttons?
reply
    Bookmark Topic Watch Topic
  • New Topic