Jquery validator textbox not equal to default value -


I am trying to validate my form because users enter information on the button click, do not submit. I'm trying to do something that detects that the text in the text box is the default value. However, it is not working

I'm not really familiar with jquery validator, this is what I still have.

  $ (document) .on ("click", "#numexercisesbutton, #submitworkout", function () {// exercise adds jQuery.validator.addMethod ("notEqual", function ( Value, element, absolute) {return.optional (element)} value! == param;}, "Please select a value!"); $ ("# Addworkout"). Validate ({Rule: {weightinputboxes: {Required} : True, notEqual: "Enter weight"}}, Message: {weightinputboxes: {notEqual: "Please enter a value"}}}} ($ ("# addworkout"). Valid ()) {addexercises.call this );}});   

Actually this is not really why it is not working I am trying to emulate this post:

Edit HTML:

  & lt ;! DOCTYPE html public "- // W3C // DTD HTML 4.01 transcription // n" "http://www.w3.org/TR/html4/loose.dtd"> & Lt; Html & gt; & Lt; Top & gt; & Lt; Meta http-equiv = "content-type" content = "text / html; charset = ISO-885 9-1" & gt; & Lt; Title & gt; Insert title here & lt; / Title & gt; & Lt; Script type = "text / javascript" src = "/ static / jquery-1.7.2.min.js" & gt; & Lt; / Script & gt; & Lt; Script type = "text / javascript" src = "/ static / jquery-ui-1.8.21.custom.min.js" & gt; & Lt; / Script & gt; & Lt; Link rel = "stylesheet" href = "/ static / jquery-ui-1.8.21.custom.css" type = "text / css" & gt; & Lt; Script type = "text / javascript" src = "/ static / jquery.validate.js" & gt; & Lt; / Script & gt; & Lt; Script type = "text / javascript" src = "/ static / jquery.validate.min.js" & gt; & Lt; / Script & gt; & Lt; Link rel = "stylesheet" href = "/ static / addworkout.css" type = "text / css" & gt; & Lt; Script type = "text / javascript" src = "/ static / addworkout.js" & gt; & Lt; / Script & gt; & Lt; / Head & gt; {% "Masterpage.html"%} extends {% block content%} & lt; Body & gt; & Lt; Form action = "/ submitworkout /" method = "go" id = "addworkout" & gt; & Lt; Div id = "workoutentrycontainer" & gt; & Lt; Div id = "exercisesthisworkout" & gt; & Lt; P & gt; Exercise date: & lt; / P & gt; & Lt; Input type = "text" class = "required" id = "workoutdate" name = "workoutdate" & gt; & Lt; P & gt; Body weight: & lt; / P & gt; & Lt; Input type = "text" class = "textbox" id = "weight" name = "weight" & gt; & Lt; P & gt; How many unique practices & lt; / P & gt; & Lt; Input type = "text" class = "required text box" id = "numexercises" name = "numexercises" & gt; & Lt; Input type = "button" class = "button" value = "add" id = "numexercisesbutton" & gt; & Lt; Input type = "text" value = "enter weight" name = "weightwindowboxes" class = "required" & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt; / Form & gt; & Lt; / Body & gt; {% Endblock%} & lt; / Html & gt;    

  $ ("# .."). Validate ({..})   

Works on the focus exits from the box, click and are blurred.

In your code, the flow is the same:

  1. Clicking on the button will activate the verification method.
  2. After clicking on the button, when you type in the text box and focus the box outside the Vedicator, the value will be valid.

Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -