• 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

Help on jvascript and validation

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please excuse me if i am irritating with silly questions. I am a beginner in the programming world. My problem is that from my home page on a button click an alert box has to come. This i have done with javascript, but when i do this the page validation of the home page is skipped. i want the page to be validated first and then ,only if the validation satisfies the alert box should come up. What will i do??? Please do help me....
 
Saloon Keeper
Posts: 27752
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not sure if basic JSF can do this, but I know that RichFaces has a "oncomplete" attribute that can be fired when the action method has run and returned. This only applies to AJAX requests, since non-AJAX submits will reload the entire page, wiping out any JavaScript set up for the previous page display before it can execute.

However, the action method won't run if the builtin validators reject data.

Then again, the whole idea of a popup "data is OK" dialog is a bit suspect, since JSF should be displaying validation errors on the updated web page. So invalid data will cause error display and the action method won't fire. Valid data will cause no error display and the action will fire, and usually at that point, you'll be navigating to to a new page. Although I do have some apps that add a "record 'XYZ' updated successfully" message to the current page and redisplay it.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic