Thanks to visit codestin.com
Credit goes to github.com

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

fix(ngForm): 2513 ngForm triggers click/submit events like normal form #6704

Closed
wants to merge 4 commits into from

Conversation

andytompkins
Copy link

Fix for issue #2513

@mary-poppins
Copy link

Thanks for the PR! Please check the items below to help us merge this faster. See the contributing docs for more information.

  • Uses the issue template (#6704)

If you need to make changes to your pull request, you can update the commit with git commit --amend.
Then, update the pull request with git push -f.

Thanks again for your help!

@@ -411,6 +411,67 @@ var formDirectiveFactory = function(isNgForm) {
extend(controller, nullFormCtrl); //stop propagating child destruction handlers upwards
});
}

if (isNgForm) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indentation is a mess here, can you fix this? 2 space soft-tabs

@andytompkins
Copy link
Author

Sorry, WS8 EAP has some issues :) Fixing...

@@ -411,6 +411,67 @@ var formDirectiveFactory = function(isNgForm) {
extend(controller, nullFormCtrl); //stop propagating child destruction handlers upwards
});
}

if (isNgForm) {
var inputs = formElement.find('input');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

button elements can also trigger submission, among other things. http://www.whatwg.org/specs/web-apps/current-work/multipage/forms.html#category-submit

@caitp
Copy link
Contributor

caitp commented Mar 17, 2014

So, this is a lot of code, and that is maybe not very good. There are problems, like not dealing with dynamically added controls, not dealing with other ways to submit a form, etc. If there are nested ngForms (one of the reasons people use them at all), it will add multiple event handlers to each child control, etc etc... Beyond that, it also really needs a test case (actually, a number of test cases, because this is not a simple feature).

So, there's a lot more to do here, this is unfortunately not a low-hanging fruit kind of bug =(

@btford btford added this to the Backlog milestone Mar 17, 2014
@mary-poppins
Copy link

I'm sorry, but I wasn't able to verify your Contributor License Agreement (CLA) signature. CLA signature is required for any code contributions to AngularJS.

Please sign our CLA and ensure that the CLA signature email address and the email address in this PR's commits match.

If you signed the CLA as a corporation, please let us know the company's name.

Thanks a bunch!

PS: If you signed the CLA in the past then most likely the email addresses don't match. Please sign the CLA again or update the email address in the commit of this PR.
PS2: If you are a Googler, please sign the CLA as well to simplify the CLA verification process.

@mary-poppins
Copy link

CLA signature verified! Thank you!

Someone from the team will now triage your PR and it will be processed based on the determined priority (doc updates and fixes with tests are prioritized over other changes).

@tbosch
Copy link
Contributor

tbosch commented Apr 3, 2014

Hi,
ng-form is just for grouping controls, it was never meant to be a replacement for a real form with all of its capabilities (e.g. posting to the server, ...). You are right that the docs don't state this very well. I will update the docs with another sentence to clarify this.

Thanks for your PR though!

@tbosch tbosch closed this Apr 3, 2014
tbosch added a commit that referenced this pull request Apr 3, 2014
tbosch added a commit that referenced this pull request Apr 3, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants