Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I use x-editable and jquery validation plugin

How can i validate information using jquery validation plugin when using XEDITABLE for edit-in-place?

This is my current non-validated x-editable field

enter image description here

This is what i pretend

enter image description here

like image 363
Lothre1 Avatar asked May 04 '14 16:05

Lothre1


People also ask

How we can use jQuery validation plugins in MVC?

For jQuery form validation to work, we set "HtmlHelper. UnobtrusiveJavaScriptEnabled = false;" property false in the register form instead of "web. config" file; this means if we set the value false for above property in "web. config" file, then we will disable client side validation across application.


1 Answers

I use valib.js instead of stone jquery validation

HTML:

<p>X-editable Bootstrap popup</p>
<div style="margin: 150px">
    <a href="#" id="email">awesome</a>
</div>

JS:

$('#email').editable({
    type: 'text',
    url: '/post',    
    pk: 1,    
    placement: 'top',
    title: 'Enter email' ,
    validate:function(value){

       var v=valib.String.isEmailLike(value)         
       if(v==false) return 'Please insert valid mail';
    }   
});

DEMO

like image 68
dm4web Avatar answered Sep 29 '22 14:09

dm4web