You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Howard M. Lewis Ship (JIRA)" <ta...@jakarta.apache.org> on 2005/08/13 16:01:54 UTC

[jira] Created: (TAPESTRY-554) Hook needed on client side to control how validation errors are presented to the user

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
 Assigned to: Howard M. Lewis Ship 


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. 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org


Re: [jira] Closed: (TAPESTRY-554) Hook needed on client side to control how validation errors are presented to the user

Posted by liigo <li...@hotpop.com>.
在 Sat, 13 Aug 2005 23:05:58 +0800,Howard M. Lewis Ship (JIRA)  
<ta...@jakarta.apache.org> 写道:

>      [ 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: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org


[jira] Closed: (TAPESTRY-554) Hook needed on client side to control how validation errors are presented to the user

Posted by "Howard M. Lewis Ship (JIRA)" <ta...@jakarta.apache.org>.
     [ 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

> 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. 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org