Skip to content
This repository was archived by the owner on Apr 23, 2018. It is now read-only.
This repository was archived by the owner on Apr 23, 2018. It is now read-only.

required=true not working as I would expect it to #58

@hut8

Description

@hut8

I apologize in advance if I don't understand what required=true is supposed to do, but it seems to me like it should be the same as just adding the "required" attribute for other elements such as textarea.

When I do this:

<form name="myForm" novalidate>
  <textarea ng-model="someText" required>
  <button type="submit" class="btn btn-primary" ng-disabled="myForm.$invalid">Submit</button>
</form>

The submit button will be disabled until I put something in the textarea.

However if I do this:

<form name="myForm" novalidate>
    <div
      class="btn btn-primary btn-upload"
      url="/api/documents"
      param="file"
      required="true"
      upload-button>Upload</div>
  <button type="submit" class="btn btn-primary" ng-disabled="myForm.$invalid">Submit</button>
</form>

Then I can press "Submit" just fine even when there's no file selected.

Of course you'll see I added novalidate, but the point still stands, because even in the official AngularJS guide to forms (https://docs.angularjs.org/guide/forms) they always use novalidate on the form and everything works (as Angular then takes over the job of applying validations from the browser). Does this make sense?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions