Skip to content
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

Placeholders Submitted as Value #75

Open
john-cheesman opened this issue Jun 27, 2014 · 15 comments
Open

Placeholders Submitted as Value #75

john-cheesman opened this issue Jun 27, 2014 · 15 comments

Comments

@john-cheesman
Copy link

If a form is submitted with fields that have not been completed, the placeholder text is submitted as their value. Is it possible to remove the placeholders on submit to prevent them from being submitted?

@RobQuistNL
Copy link

This. Very much this. Came here to check this issue.

@RobQuistNL
Copy link

I've had this happen on IE11 on Win7

@RobQuistNL
Copy link

@john-cheesman I've fixed it by making sure that IE11 doesn't run on IE8 compatibility mode. It works for IE8 and not for 11 in comp. mode.

@olefredrik
Copy link

+1 Having the same issue in Win7 IE9. The placeholder text is occasionally inserted as value when form is submitted.

@vikuseth
Copy link

Is there any fix for this ?

@RobQuistNL
Copy link

This project seems kinda dead.

@jamesallardice
Copy link
Owner

I will get around to investigating this. There is already code in there to remove placeholders before form submission but clearly there's a bug with it somewhere. I'm more than happy to accept pull requests should anyone like to take a look.

@RobQuistNL The project isn't dead, just slow-moving. Mainly because I'm busy with other things but also because this project should be becoming less and less necessary. Browser support for the placeholder attribute is strong and it's only really IE9 and below that this is now helpful for. Since I don't have to support IE9 or below in any of my projects this ends up taking a back seat. As mentioned previously, I'm always happy to accept pull requests.

@RobQuistNL
Copy link

Ah right, sorry @jamesallardice - i had that idea because of the old commits and responses. You're right that this is less and less useful.

@vikuseth for the time being you could try to fix it server-side?

@apokryfos
Copy link

Not sure if this is the appropriate issue to post in, but when using the Zebra datepicker plugin in IE 8 or IE 9, the placeholder text is submitted as the value. Not sure if the bug is in Zebra or in this plugin, but the Zebra plugin without the placeholders plugin doesn't show placeholders on IE 8 and IE 9 at all so I am guessing the surprise input is coming from here.

@littletijn
Copy link

I found the problem within the function newElement( elem ).
In this function there is a check:

var form = elem.form;
if ( form && typeof form === 'string' ) {

The property elem.form is the actual form for me. So I modified the check:

var form = elem.form;
if (form) {

Then I removed the line:

// Get the real form.
form = document.getElementById(form);

because form now already contains the actual form. After this, the placeholders get removed on submit correctly and are not POST-ed by the form.

@rmorrin
Copy link

rmorrin commented Nov 25, 2015

@jamesallardice Can you confirm the fix provided by @littletijn is safe to use? I've tried what is suggested and it does seem to resolve the issue.

@Probocop7
Copy link

I've also just tried the above fix, and it does indeed seem resolve the issue.

@rmorrin
Copy link

rmorrin commented Nov 30, 2015

Looks like there are no ill-effects when using this fix (and reading the code, it looks to have been an innocent oversight). @littletijn do you want to submit a PR for this? If no, I am happy to put one together myself, crediting where necessary.

@littletijn
Copy link

Whoops. I forgot I had this fix on GitHub. I just found the e-mail for the replies on this issue. Thanks for making the commit on behalf of me.

@pihug12
Copy link

pihug12 commented May 15, 2016

@jamesallardice Can you, please, put up a 4.0.2 build with this fix? It's really needed for IE9.

Many thanks @littletijn & @rmorrin for the fix! 👍

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

No branches or pull requests

10 participants