Changeset 1851
- Timestamp:
- 11/04/08 14:24:09 (2 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
siteapp/trunk/opengeo/almanac/templates/almanacadd.pt
r1734 r1851 40 40 41 41 <script> 42 var nAllowedDescriptionChars = 400; 42 43 jQuery(document).ready(function() { 43 44 jQuery('div.theme-widget input').focus(function() { … … 45 46 return false; 46 47 }); 47 48 48 49 49 // 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); 54 61 }); 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); 62 64 }); 63 65 64 66 function updateRemainingChars(textArea) { 65 var remaining = 400- jQuery(textArea)[0].value.length;67 var remaining = nAllowedDescriptionChars - jQuery(textArea)[0].value.length; 66 68 jQuery('#char-count')[0].innerHTML = remaining; 67 69 }
