Question

I just installed django-parsley to give it a try for my forms. For testing, I'm trying to set it up on a simple front-end blog posting form: https://dpaste.de/Hh57

I'm able to view source on the page and see that the data-parsley attributes are added to each input field of my form. But, nothing happens. I noticed that the parsley.js file was not showing in the <head> when I viewed source so I copied parsley.js over to my static files directory and manually added a link to it and still not getting anything happening when I submit the blank form.

Any ideas what I'm doing wrong?

Était-ce utile?

La solution

I figured out the fix to my problem.

In the django-parsley readme on github: https://github.com/agiliq/django-parsley

It instructs to put your form inside of:

<form parsley-validate>
    {{ form.as_p }}
</form>

This is what I was trying with no luck. I ended up finding another article which showed they were using:

<form data-parsley-validate>

Which seems to work.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top