Win a copy of Mastering Corda: Blockchain for Java Developers this week in the Cloud/Virtualization forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

Struts Validator Issues

 
Ranch Hand
Posts: 472
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good day to all,

i facing an issue in validation, the problem is when i click the button which call javascript function to active submit(), it does provide validation but prompt me the javascript error after validation

error :


check on html source, found it as below line 820(bold)


validation.xml :


jsp page (note that this is simplify version and i using image button to forward):


anyone can spot what mistake i make ? thank you very much for guidance
[ January 27, 2007: Message edited by: Nakata kokuyo ]
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The problem is your use of "this". When you call a function from an event, "this" refers to the control to which the event is attached. So, if you refer to "this" within an onsubmit event of a form tag, "this" refers to the form.

However, if you use "this" within a function as you have done, "this" refers to the function, not the form. That's why it causes problems when passed as a parameter to the validator fuctions. If you change the statement

to

It should work.

One other observation: Everything after the above statement in the doForward function is unreachable code. I'm sure that's not what you intended.
[ January 27, 2007: Message edited by: Merrill Higginson ]
 
You’ll find me in my office. I’ll probably be drinking. And reading this tiny ad.
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic