cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Benjamin Boksa <>
Subject [workaround] validation-message on tabs when using ajax
Date Fri, 23 Jan 2009 14:01:48 GMT
Hi All,

I use the snippet below to enable the "validation-icon on tab" effect  
when using tab-styled groups in my ajax-enabled form template. As  
there were some discussions about this some months ago I thought some  
of you might be interested. Please be aware that this is only a  
(ugly?) workaround to enable the effect and that I am not a dojo 0.4.3- 
guru, however it works for me (tested on Safari 3.2.1/Mac, FF 3.0.1/ 
Mac, IE 7/Win).

The function must be called after the AJAX-response has been processed  
- I call it in my extended cocoon.forms.AjaxForm right after  

If you have any questions/improvements let me know about them. Hope  
that helps some of you.



     _addValidationMessageIconToTabs: function() {
         var span; // this will be initialized below only when needed
         var tabAreas = dojo.html.getElementsByClass('forms-tabArea  
forms tabArea');

             function(tabArea) {
                 var parent = tabArea.parentNode; // no wrapper for  
parentNode in dojo 0.4.3?!
                 var tabs = dojo.html.getElementsByClass('forms-tab  
forms tab', tabArea);

                     function(tab, index) {
                         var tabContent =  
dojo.html.getElementsByClass('forms-tabContent forms tabContent',  
                         var validationMsgs =  
                         if (validationMsgs.length !== 0) {
                             if (!span) {
                                 span =  
document.createElement('span'); // no wrapper for createElement in  
dojo 0.4.3?!
                                 dojo.html.addClass(span, 'forms- 
validation-message forms validation-message');
                                 var img =  
message.gif', 0);
                                 dojo.dom.insertAtPosition(img, span,  

                             if (dojo.html.getElementsByClass('forms- 
validation-message forms validation-message', tab).length === 0) {
dojo.dom.insertAtPosition(span.cloneNode(true), tab, 'last');  // no  
wrapper for cloneNode in dojo 0.4.3?!

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message