问题
I've tried to duplicate the sample bootstrap/parsley form in jsfiddle with bootstrap 3 parsley 2.2.0-rc4 http://jsfiddle.net/bwolfsohn/9wfjo94w/14/
the form pops up the message: Yay, everything seems to be ok.. then errors out with:
{"error": "Shell form does not validate{'html_initial_name': u'initial-js_lib', 'form': <mooshell.forms.ShellForm object at 0x2971b90>, 'html_name': 'js_lib', 'html_initial_id': u'initial-id_js_lib', 'label': u'Js lib', 'field': <django.forms.models.ModelChoiceField object at 0x2997bd0>, 'help_text': '', 'name': 'js_lib'}{'html_initial_name': u'initial-js_wrap', 'form': <mooshell.forms.ShellForm object at 0x2971b90>, 'html_name': 'js_wrap', 'html_initial_id': u'initial-id_js_wrap', 'label': u'Js wrap', 'field': <django.forms.fields.TypedChoiceField object at 0x29974d0>, 'help_text': '', 'name': 'js_wrap'}"}
The original sample is at: http://parsleyjs.org/doc/examples/simple.html
回答1:
I'm not too sure what that error is, but I've updated the example, hopefully it will make things clearer and better.
回答2:
OK.. This looks like a jsfiddle problem... I manually loaded it and ran it on codepen with no problem...
http://codepen.io/bwolfsohn/pen/dGbePr
You've just POSTed to a Pen.
Values Posted
fullname brian wolfsohn
email brian@cus.com
gender M
message
Values as JSON
{"fullname":"brian wolfsohn","email":"abc@def.com","gender":"M","message":""}
来源:https://stackoverflow.com/questions/34037960/parsley-form-will-not-validate