This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Building Blockchain Apps and have Michael Yuan on-line!
See this thread for details.
Win a copy of Building Blockchain Apps 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 ...
  • Campbell Ritchie
  • Paul Clapham
  • Liutauras Vilda
  • Knute Snortum
  • Bear Bibeault
  • Devaka Cooray
  • Jeanne Boyarsky
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • salvin francis
  • Tim Holloway
  • Piet Souris
  • Frits Walraven

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


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 ]
mooooooo ..... tiny ad ....
Java file APIs (DOC, XLS, PDF, and many more)
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!