Do you have an old version of web2py.js? In the current version, it is:

jQuery('.error', target).hide().slideDown('slow');

Note that the jQuery selector now includes "target", which limits it to 
just the component div when the component is loaded. I think that should 
prevent the double display -- when the component loads, it won't affect 
anything in the outer page.

Anthony

On Monday, January 23, 2012 6:13:21 PM UTC-5, Jim Karsten wrote:
>
> If a page has a component, the validation error messages may display a 
> second time. In web2py_ajax.html the function web2py_ajax_init() gets 
> called twice, first when the main page loads called by 
> *jQuery(document).ready(function() 
> {});* and second when the component loads, called by function *
> web2py_ajax_page()*. If the component loads quickly, the second display 
> may not be visible. I am working with a component that has a minor delay as 
> it loads data and the validation errors on the main page form display, then 
> hide and display again.
>
> I made this change to function web2py_ajax_init()
> was:  
>   jQuery('.error').hide().slideDown('slow');
> now: 
>       jQuery('.error').each( function () 
> {                                                                             
>               
>
>         if (! jQuery(this).data('_error_shown')) 
> {                              
>           jQuery(this).hide().slideDown('slow').data('_error_shown', 
> 1);        
>         
> }                                                                       
>       });                                  
>
> Each error message displays only once now.
>

Reply via email to