• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

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?
 
Seriously? That's what you're going with? I prefer this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic