John Brunner
John Brunner

Reputation: 2872

Parsley validation is not running (even on a plain html file)

I love Parsley's style of form validation with beautfiul background-color at the form elements (green -> correct, red -> wrong), but I can't figure out how to implement this.

I followed the instructions line per line, but it's not working. Maybe my other js resources disturb the flow, so I made a plain new html site, but it also doesn't work either.

What am I doing wrong?

My plain .html looks like that:

<html>
<head>
    <link href="http://twitter.github.com/bootstrap/assets/css/bootstrap.css" rel="stylesheet">
    <script type="text/javascript" src="http://code.jquery.com/jquery-1.7.js"></script>
    <script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/2.0.2/bootstrap.min.js"></script>
    <script type="text/javascript" src="pars/parsley.js"></script>
</head>

<body>
<form id="demo-form" data-validate="parsley">
  <label for="fullname">Full Name * :</label>
  <input type="text" id="fullname" name="fullname" data-required="true" />
  <input type="submit" value="ok" />
</form>
</body>
</html>

I'm leaving the field blank, click "ok", and nothing happens.

I was able (don't ask me how) to run Parsley for a short time, but without the fancy background-colors. Do you know what to do?

Upvotes: 2

Views: 3497

Answers (1)

guillaumepotier
guillaumepotier

Reputation: 7448

Parsley does not manage colors / UI. It justs add / remore css classes depending on validation.

By default: parsley-error and parsley-success. They could be changed in parsley config.

But you will have still to do some css to tell that parsley-success for example has green background and parsley-error a red one.

Upvotes: 3

Related Questions