javascript - Validation Twitter Bootstrap with Django -
i using django , twitter bootstrap. using following code validation. add more validations. example if variable django false
return 'owner not exist'. tried following not working.
<script type="text/javascript"> var test = {msg_owner|safe} $(document).ready(function() { $('#frm').bootstrapvalidator({ message: 'this value not valid', feedbackicons: { valid: 'glyphicon glyphicon-ok', invalid: 'glyphicon glyphicon-remove', validating: 'glyphicon glyphicon-refresh' }, fields: { 'owner': { validators: { notempty: { message: 'please enter owner' } test==false: { message: 'owner not exist' } } } }); }); </script>
in server side this:
def test(request): msg_owner = false return render_to_response("hello.html", {'msg_owner': msg_owner})
try this:
var test = {{msg_owner|safe}};
Comments
Post a Comment