-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Placeholder text getting submitted with form #21
Comments
If your inputs use ngModel, you can avoid the problem by working with the model values directly. The shim only adds the placeholder text to the DOM, it will not change the model values. If you're not using ngModel, you can clear the placeholder text on submit. Here's one way to do it with ngSubmit: <form ng-submit="clearPlaceholders($event)">...</form> $scope.clearPlaceholders = function(event){
// select elements displaying placeholder
var inputs = event.target.querySelectorAll('.empty');
// clear elements
for (var i = 0; i < inputs.length; i++) {
inputs[i].value = '';
}
} Demo: http://codepen.io/cvn/pen/waKKXb It might be possible to add this functionality to the shim, so the elements would clear themselves on submit, and you wouldn't have to handle it manually, but I can't think of a good way to do it yet. |
Thanks. |
In my setup, the input and textarea are not showing any empty class |
If you post your code to a site like codepen, I can take a look. It sounds like it's not configured correctly. |
difficult. it is a very large application. I'll try a plain setup if it occurs there as well, I'll share the codepen/plunker |
Sorry...My bad, its there. when i was inspecting the control had focus so class was not showing. thanks |
testing in IE8 (emulation mode)
the placeholder text is getting submitted as input value with the form object. How can this be avoided?
The text was updated successfully, but these errors were encountered: