Announcement Announcement Module
Collapse

Spring Modules forum decommissioned in favor of Spring Extensions

As the Spring Modules project has been replaced by the Spring Extensions (http://www.springsource.org/extensions) project, this forum has been decommissioned in favour of Spring Extensions one at:
http://forum.springsource.org/forumdisplay.php?f=44

Please see the Spring Extensions home page for a complete list of current projects in Java, .NET and ActionScript. You can also propose one if you want.

Cheers,
Costin Leau
SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
http://twitter.com/costinl
See more
See less
Valang error: "Exception thrown and not caught" Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Valang error: "Exception thrown and not caught"

    Hi,
    I have been using Spring for more than an year now but I am new to Valang validation framework.

    Using Spring 2.0 RC3 and Spring modules 0.6, I followed the steps in valang documentation. I am also using the new <form:> tags in my jsps and use sitemesh decorator to decorate the pages.

    I get the following javascript error.

    "Exception thrown and not caught".

    I verified a couple of times to make sure that I have the valang_codebase.js file included, the validate call is inside the form etc.

    Any ideas on what I might be missing?

    Thanks
    Mandar

  • #2
    Try the following:

    At around line 119 of the JavaScript file, replace this code:

    Code:
    if (!element || element.tagName.toLowerCase() != 'form') {
          element = document.getElementById(name+'ValangValidator')
      }
    if (!element|| element.tagName.toLowerCase() != 'script') {
            throw 'unable to find form with ID \'' + name + '\' or script element with ID \'' + name +'ValangValidator\''
      }

    with this code:
    Code:
    if (!element || element.tagName.toLowerCase() != 'form') {
          element = document.getElementById(name+'ValangValidator')
        if (!element|| element.tagName.toLowerCase() != 'script') {
            throw 'unable to find form with ID \'' + name + '\' or script element with ID \'' + name +'ValangValidator\''
        }            
      }
    In the original code, it ends up checking a reference to the form element for a 'script' tagname and throwing the 'unable to find form or script element' exception.
    Last edited by Barend; Dec 4th, 2006, 07:32 AM. Reason: the post ended up with a thumbs-down icon, which is just silly

    Comment


    • #3
      Valang error: &quot;Exception thrown and not caught&quot;

      I am getting a similar javascript error with client side Valang validation (server side validation works fine). I traced the error to the javascript code generated by valang:codebase tag. I have a input type=button on the page. It is not being handled and that is causing the exception. So I made a modification (as marked by the comment in code - line 351 onwards - below) in valang_codebase.js. However, the javascript generated in the page does not have the modification I made and I still get the error. What I have missed?

      Code:
              switch (this.type) {
              case 'submit':
              case 'hidden':
              case 'password':
      	// added case button to prevent exception being thrown for buttons
      	case 'button': 
              //--- end of modification
              case 'text':
                  this.getValue = ValangValidator.Field.ValueGetters['textarea'] 
                  break
              case 'checkbox':
              case 'radio':
                  this.getValue = ValangValidator.Field.ValueGetters['inputSelector'] 
                  break
              default:
                  throw 'unexpected input field type \'' + this.type + '\''

      Comment


      • #4
        Never mind. I was including valand_codebase.js and using valang:codebase tag. I removed the tag and it started working properly.

        Comment

        Working...
        X