| [ Index ] |
PHP Cross Reference of Drupal 6 (gatewave) |
[Summary view] [Print] [Text view]
1 // $Id: audio.js,v 1.2 2008/11/26 01:17:58 drewish Exp $ 2 3 /** 4 * Auto-attach standard client side file input validation. 5 */ 6 Drupal.behaviors.audioValidateAutoAttach = function(context) { 7 $("input[@type='file'][audio_accept]", context).change( function() { 8 $('.audio-js-error').remove(); 9 10 /** 11 * Add client side validation for extensions. 12 */ 13 var accept = $(this).attr('audio_accept'); 14 if (accept.length > 1) { 15 v = new RegExp('\\.(' + accept.replace(/,\s*/g, '|') + ')$', 'gi'); 16 if (!v.test(this.value)) { 17 var error = Drupal.t("The selected file %filename cannot not be uploaded. Only files with the following extensions are allowed: %extensions.", 18 { '%filename' : this.value, '%extensions': accept } 19 ); 20 // What do I prepend this to? 21 $(this).before('<div class="messages error audio-js-error">' + error + '</div>'); 22 this.value = ''; 23 return false; 24 } 25 } 26 }); 27 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Thu Mar 24 11:18:33 2011 | Cross-referenced by PHPXref 0.7 |