Changeset 16206

Show
Ignore:
Timestamp:
14/07/08 13:57:03 (2 months ago)
Author:
jakub
Message:

Javascript validation that bags are not used when link is generated.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/intermine/webapp/main/resources/webapp/template.jsp

    r16187 r16206  
    129129   function forwardToLinks() 
    130130   { 
     131       // needed validation that bag is not used, validation is performed in the Struts action as well 
     132       if (isBagUsed()) { 
     133            new Insertion.Bottom('error_msg','Link could not be created. This template contains list constraint(s). The service for this special template is not implemented yet. Solution: Don\'t use list contraint.<br/>'); 
     134            haserrors=1; 
     135            Effect.Appear('error_msg');        
     136            return; 
     137       } 
    131138       document.getElementById('actionType').value = 'links'; 
    132139       document.templateForm.submit(); 
     140   } 
     141    
     142   function isBagUsed() { 
     143        // checks if bag is used, the presumption is that there aren't more than 10 bag constraints  
     144        for (var i = 0; i < 10; i++) { 
     145            if (document.templateForm["useBagConstraint("+i+")"]) { 
     146                if (document.templateForm["useBagConstraint("+i+")"].checked) { 
     147                    return true; 
     148                }                 
     149            } 
     150        } 
     151        return false; 
    133152   } 
    134153