Jump to content

jquery validate plugin problem


jimfog
 Share

Recommended Posts

I am trying to use jquery validate plugin in combination with backbone and other plugins also(jquery UI component).

 

The problem is I cannot get it to work...

 

Take a look at this fiddle.....http://jsfiddle.net/fiddlehunt/zd5P9/ if you click on the calendar in the results pane a dialog box appears with an input named title.

 

I am trying to set this to be "required" by using jquery validate code found in the bottom of the JS pane...it does not work though.

 

What can be wrong here?The console does not present any error relevant to the validate plugin,it does present an error though relevant to backbone.js which I do not think affects the jquery validate code.

Link to comment
Share on other sites

It looks to me like the "OK" button isn't inside the form and is not submitting the form. The form will probably only validate fields if somebody tries to submit it.

yes an OK/submit button is needed....the problem in my case though is the fact that despite a submit is needed to make the plugin-

an actual submit must never take place cause in this case here the data sent to the server are sent with backbone code.

 

After a search I made a submitHandler http://jqueryvalidation.org/validate#submithandler function might be able to solve the issue-something I have not managed to do yet.

 

This a jsbin demo http://jsbin.com/gaqamu/5/

 

Go at see the save function at line 94,with validate code in it(the whole js file of course is backbone code).

 

Go and click the calendar in the right and a pop up box will appear...press OK-see if the validation message(as defined in the required attribute).

Currently its behavior is weird....sometimes validation takes place and other times no.

 

I am still trying to make this work.

Edited by jimfog
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...