在 Sat, 13 Aug 2005 23:05:58 +0800,Howard M. Lewis Ship (JIRA) <[email protected]> 写道:

     [ http://issues.apache.org/jira/browse/TAPESTRY-554?page=all ]
Howard M. Lewis Ship closed TAPESTRY-554:
-----------------------------------------

    Fix Version: 4.0
     Resolution: Fixed

To make use of this feature, you need to add a little JavaScript:

document.forms.myform.events.invalid_field_handler = function(event, field, message)
{
   . . .
}

The event is the FormSubmitEvent
The field is the DOM object for the field being validated
The message is the message to present to the user


That's great!



Hook needed on client side to control how validation errors are presented to the user
-------------------------------------------------------------------------------------

         Key: TAPESTRY-554
         URL: http://issues.apache.org/jira/browse/TAPESTRY-554
     Project: Tapestry
        Type: Improvement
  Components: Framework
    Versions: 4.0
    Reporter: Howard M. Lewis Ship
    Assignee: Howard M. Lewis Ship
     Fix For: 4.0


Right now, client-side JavaScript functions such as required() and validate_min_length() invoke a method handle_invalid_field(). handle_invalid_field() calls window.alert() to display the message, then sets event.abort and event.cancelListeners. event.cancelListeners is important, otherwise each invalid field will raise the alert window! However, if you can imagine a much more sophisticated scheme, where we use DHTML to update the page and display errors as HTML (rather than a popup window) .... then we need a way to hook handle_invalid_field(), so that we can perform a different operation. My first thought was that we could simply provide an overriding implementation of the function ... however, that doesn't handle cases where a page has multiple forms. My thoughts are to add a method to FormSubmitEvent for alterting the user about errors; this would delegate to a function provided by FormEventManager. This function could be set by a Script's <initilaization> block.





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to