Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

AngularJS is Disabling Forms #9065

Closed
ghost opened this issue Sep 13, 2014 · 3 comments
Closed

AngularJS is Disabling Forms #9065

ghost opened this issue Sep 13, 2014 · 3 comments

Comments

@ghost
Copy link

ghost commented Sep 13, 2014

If you create a form without an action and a controller in Angular, you will not be able to submit the form, see plunk:

http://plnkr.co/edit/gWFRMKGO3FzZtOgs4VmW?p=preview

Is this desired behaviour? If so, how do I disable it?

@caitp
Copy link
Contributor

caitp commented Sep 15, 2014

if action is falsy, then it will not submit the form natively. You could give it a value like action="#" or something, that would probably work.

@ghost
Copy link
Author

ghost commented Sep 15, 2014

I am not familiar with how all browsers will handle action="" on a form, but all browsers I have tested default action="" to the current URL and will submit the form. action="#" is different, particularly if you use the html base tag.

I have created a new plunk demonstrating it:

http://plnkr.co/edit/B8nrc4NzZg3TWVNzv7yB?p=preview

Case 1: Form with action="" inside ng-app - submission is disabled
Case 2: Form with action="" outside ng-app - submits to the current url

N.B. Angular will only disable submission if you create a controller.

I do not see why Angular would disable the form. It has not been told to do anything with any elements on the page. No modules have been loaded.

@Narretz
Copy link
Contributor

Narretz commented Sep 15, 2014

There's a pull request to change that which needs some love: #3776
Having an empty action attribute is a valid use case.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants