• 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
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Tim Cooke
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
  • Piet Souris
Bartenders:
  • Stephan van Hulst

both javascript and serverside validations running

 
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

i am using javascript validation along with server side validation using struts.

the problem is that both validations are running one after the other.

how to control this so that only javascript validation runs? if javascript is disabled the serverside validations should take place.

thanks,
Seshu
 
author & internet detective
Posts: 41992
911
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Seshu,
I don't think you can. The sever side validation is supposed to be a fail safe for when javascript is disabled. As they should be checking for the same rules, it isn't a problem if both run.
 
Sree Jag
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi Jeanne,

But the problem is the html:errors tag present in the jsp displays the serverside errors too. we don't want both javascript and serversside errors to show up right?.

and also, the struts site says that the form will not be submitted if the javascript validation fails. but the form is getting submitted even if there are errors. i think that is the problem behind both validations being performed.

any ideas y the form is being submitted even if javascript validation fails?


Seshu
 
Jeanne Boyarsky
author & internet detective
Posts: 41992
911
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Seshagiri,
Are you using any other javascript on the page? If there are javascript errors, a form may submit regardless off the validation.

Also, can you post the line of code from the generated HTML (not the JSP) beginning with <form
 
pie sneak
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I agree with Jeanne. There is probably other javascript on the page that is causing the form to submit.
 
Ranch Hand
Posts: 157
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Peter den Haan had given a solution to a similar problem some time back. Check if this applies to you.

Sheldon Fernandes
[ September 30, 2004: Message edited by: Sheldon Fernandes ]
 
Sree Jag
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey all,
Yeah there r some javascript errors on the page. May be thts the reason y the form is getting submitted. Thanks for the replies..

Seshu.
 
Whip out those weird instruments of science and probe away! I think it's a tiny ad:
New web page for Paul's Rocket Mass Heaters movies
https://coderanch.com/t/785239/web-page-Paul-Rocket-Mass
reply
    Bookmark Topic Watch Topic
  • New Topic