Comunidad oficial de diseñadores web, web developers y Webmasters. Aqui podemos tratar temas actuales sobre diseño y tecnología. Podemos compartir y actualizarnos. Photoshop, Flash, PHP, ASP, Java, HTML, CSS, MySQL, CMS, etc. Unite YA y lee los Sticky

Ver más
  • 13,065 Miembros
  • 9,531 Temas
  • 3,449 Seguidores
  • 0

[AYUDA]TinyMCE Validacion


Salu2 tengo un formulario en el cual utilizo el plugin TinyMCE y ocupo el plugin jquery.validate para la validacion de los formularios pero no puedo validar el textarea de TinyMCE he leido sobre esto y he probado con las soluciones propuestas en internet incluso el plugin trae un ejemplo del uso pero no funciona dejo aqui el ejemplo


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>jQuery Validation plugin: integration with TinyMCE</title>

<script type="text/javascript" src="../../lib/jquery.js"></script>
<script type="text/javascript" src="../../jquery.validate.js"></script>
<script type="text/javascript" src="tiny_mce.js"></script>
<script type="text/javascript">
    tinyMCE.init({
        mode : "textareas",
        theme : "simple",
        // update validation status on change
        onchange_callback: function(editor) {
            tinyMCE.triggerSave();
            $("#" + editor.id).valid();
        }
    });
    $(function() {
        var validator = $("#myform").submit(function() {
            // update underlying textarea before submit validation
            
             var content = tinyMCE.activeEditor.getContent(); // get the content
    $('#content').val(content); // put it in the textarea
            
            tinyMCE.triggerSave();
        }).validate({
            rules: {
                title: "required",
                content: "required"
            },
            errorPlacement: function(label, element) {
                // position error label after generated textarea
                if (element.is("textarea")) {
                    label.insertAfter(element.next());
                } else {
                    label.insertAfter(element)
                }
            }
        });
        validator.focusInvalid = function() {
            // put focus on tinymce on submit validation
            if( this.settings.focusInvalid ) {
                try {
                    var toFocus = $(this.findLastActive() || this.errorList.length && this.errorList[0].element || []);
                    if (toFocus.is("textarea")) {
                        tinyMCE.get(toFocus.attr("id")).focus();
                    } else {
                        toFocus.filter(":visible").focus();
                    }
                } catch(e) {
                    // ignore IE throwing errors when focusing hidden elements
                }
            }
        }
    });
</script>
<!-- /TinyMCE -->

</head>
<body>

<form id="myform" action="">
    <h3>TinyMCE and Validation Plugin integration example</h3>

    <label>Some other field</label>
    <input name="title" />

    <br/>
    
    <label>Some richt text</label>
    <textarea id="content" name="content" rows="15" cols="80" style="width: 80%"></textarea>

    <br />
    <input type="submit" name="save" value="Submit" />
</form>

</body>
</html>



Alguien puede ayudarme :S

Aqui dejo los archivos para q vean q no funciona

http://www.mediafire.com/?59ygn2rp93n8d2q
  • 0
  • 0Calificación
  • 0Seguidores
  • 80Visitas
  • 0Favoritos

0 respuestas

Tienes que ser miembro para responder en este tema