Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Struts Validator Issues

 
Ranch Hand
Posts: 472
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
reply
    Bookmark Topic Watch Topic
  • New Topic