Hello all. Im using jeditable and the validation plugin. Ive read a
previous thread at: 
http://www.mail-archive.com/jquery-en@googlegroups.com/msg22070.html

However, there were no examples here which lead to a lot of confusion.
I will just reiterate the question asked on the thread mentioned
above.

1) When using jeditable plugin, how to add validate to the activated
input field or textarea field for preventing some malicious people
empty the data.

Ive tried frantically to get this working together. My jeditable works
fine. But im trying to include the validation. Ive tried putting the
validation function everywhere. After several combinations, I've not
got a clue to proceed. This is what I last ended up with:


if ($(e.target).is('p')) {
                                $('.blogSection p').editable(function(value, 
settings){


                                        var content = value;

                                        if (content) {

                                                $.ajax({
                                                        type: "POST",
                                                        url: 
"http://localhost/Paradise Calling/index.php/
BlogController/editBlog",
                                                        data: "blog_id=" + 
blog_id + "&content=" + content,
                                                        dataType: "html",
                                                        success: function(data){
                                                        }
                                                //error:function(xhr,err,e){ 
alert( "Error: " + err ); }
                                                }); // $.ajax()
                                                return (value);

                                        }
                                        else {
                                        $(this + ' form').validate({

                                                errorPlacement: function(error, 
element) {
                                                                
error.insertAfter( element.next() );
                                                          },

                                                        rules: {
                                                                content: {
                                                                                
                required: true,
                                                                                
                minlength: 5
                                                                }
                                                        },
                                                        messages: {
                                                                content: {
                                                                                
                required:       'Please enter a comment header',
                                                                                
                minLength:      'Must be at least 5 characters'
                                                                }
                                                        }

                                                }); // .validate()
                                        }

Reply via email to