Ver Mensaje Individual
  #1 (permalink)  
Antiguo 18/02/2011, 02:50
Avatar de xalupeao
xalupeao
 
Fecha de Ingreso: mayo-2008
Ubicación: Santiago, Chile
Mensajes: 749
Antigüedad: 16 años, 11 meses
Puntos: 12
Problema al validar largo con jQuery en textarea con tinyMCE

Bueno amigos tengo un problema que ya siento que me la gano por completo. Les cuento tengo esta funcion para ver el largo de un campo.

Código Javascript:
Ver original
  1. //validacion de largo de texto en un campo
  2.     function checkTextBox(idCadena,largoMin,idError){
  3.         var campo = $("#"+idCadena).val();
  4.         if(campo.length >= largoMin){
  5.             $("#"+idError).hide();
  6.             return true;
  7.         }else{
  8.             $("#"+idError).show();
  9.             //alert(campo.length);
  10.             return false;          
  11.         }
  12.     }

y bueno tengo un textarea pero OJO lo tengo con tinyMCE con la siguiente configuracion:

Código Javascript:
Ver original
  1. tinyMCE.init({
  2.       mode : 'exact',
  3.       elements: 'descripcion',
  4.       theme : "advanced",
  5.       theme_advanced_buttons1 : "bold,italic,underline,separator,strikethrough,justifyleft,justifycenter,justifyright, justifyfull,bullist,numlist,undo,redo,link,unlink,formatselect,fontselect,fontsizeselect, code",
  6.       theme_advanced_buttons2 : "",
  7.       theme_advanced_buttons3 : "",
  8.       theme_advanced_toolbar_location : "top",
  9.       theme_advanced_toolbar_align : "left",
  10.       width: '680px',
  11.       height: '300px',
  12.       remove_linebreaks : true,
  13.       remove_redundant_brs : true,
  14.       cleanup_on_startup : true,
  15.       force_br_newlines : false,
  16.       force_p_newlines : false,
  17.       forced_root_block : '', // Needed for 3.x
  18.       theme_advanced_resizing : true,
  19.       theme_advanced_resize_horizontal : false,
  20.       dialog_type : 'modal',
  21.       relative_urls : false,
  22.       remove_script_host : false,
  23.       convert_urls : false,
  24.       apply_source_formatting : false,
  25.       remove_linebreaks : true,
  26.       paste_convert_middot_lists : true,
  27.       paste_remove_spans : true,
  28.       paste_remove_styles : true,
  29.       gecko_spellcheck : true,
  30.       entities : '38,amp,60,lt,62,gt',
  31.       accessibility_focus : false
  32.   });


y bueno el textarea esta de la siguiente manera.


Código HTML:
Ver original
  1. <textarea id="descripcion" rows="16" cols="20"></textarea>


Ahora cuando ejecuto la funcion y le caso los "//" al alert me da 0, si al campo le saco el tinyMCE devuelve el valor real.

la pregunta

¿como puedo validar el largo del campo pero con tinyMCE?

Gracias :)
__________________
Hosting en Chile en Silverhost - La solución en Hosting en Chile.