0

I've got a Django form with required fields, but I don't want them to render with the html required attribute because I want to control this from Javascript.

How can I make the form render without the required attribute, while still being validated required server-side.

1 Answer 1

1

On the form, set

use_required_attribute = False

See: https://docs.djangoproject.com/en/dev/ref/forms/api/#django.forms.Form.use_required_attribute

Sign up to request clarification or add additional context in comments.

1 Comment

I've followd the same thing and added this attribute to Form items, but got TypeError: __init__() got an unexpected keyword argument 'use_required_attribute'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.