Changeset 1851

Show
Ignore:
Timestamp:
11/04/08 14:24:09 (2 months ago)
Author:
rmarianski
Message:

allow almanac description count to go negative so users can paste in stuff and be able to change it

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • siteapp/trunk/opengeo/almanac/templates/almanacadd.pt

    r1734 r1851  
    4040     
    4141    <script> 
     42    var nAllowedDescriptionChars = 400; 
    4243    jQuery(document).ready(function() { 
    4344      jQuery('div.theme-widget input').focus(function() { 
     
    4546        return false; 
    4647       }); 
    47         
    48         
     48 
    4949       // limit input on description 
    50        jQuery(document.getElementById('form.description')).keypress(function(event) { 
    51           if(jQuery(this)[0].value.length > 399 && event.keyCode != 8) { 
    52             event.preventDefault(); 
    53           }     
     50       var formDescription = document.getElementById('form.description'); 
     51       var almanacSubmit = jQuery('input[@value="Add Almanac"]'); 
     52       jQuery(formDescription).keyup(function(event) { 
     53         if(formDescription.value.length > nAllowedDescriptionChars) { 
     54           almanacSubmit.attr('disabled', 'disabled'); 
     55           almanacSubmit.attr('class', 'disabled'); 
     56         } else { 
     57           almanacSubmit.attr('disabled', false); 
     58           almanacSubmit.attr('class', 'button'); 
     59         } 
     60         updateRemainingChars(formDescription); 
    5461       }); 
    55         
    56        jQuery(document.getElementById('form.description')).keyup(function(event) { 
    57           updateRemainingChars(this); 
    58        }); 
    59        
    60         
    61        updateRemainingChars(document.getElementById('form.description')); 
     62 
     63       updateRemainingChars(formDescription); 
    6264     }); 
    63       
     65 
    6466     function updateRemainingChars(textArea) { 
    65           var remaining = 400 - jQuery(textArea)[0].value.length; 
     67          var remaining = nAllowedDescriptionChars - jQuery(textArea)[0].value.length; 
    6668          jQuery('#char-count')[0].innerHTML = remaining; 
    6769     }