• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

both javascript and serverside validations running

 
Sree Jag
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • 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
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34965
378
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • 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
  • 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
Marshal
Posts: 34965
378
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • 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
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I agree with Jeanne. There is probably other javascript on the page that is causing the form to submit.
 
Sheldon Fernandes
Ranch Hand
Posts: 157
  • Mark post as helpful
  • send pies
  • 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
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic