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

Placeholder text gets submitted to the server. #244

Open
arunkumr opened this issue Feb 12, 2015 · 7 comments
Open

Placeholder text gets submitted to the server. #244

arunkumr opened this issue Feb 12, 2015 · 7 comments

Comments

@arunkumr
Copy link

I don't know if this is me alone but the text meant for the placeholder is submitted to the server in case the form is submitted without filling certain text, I think the form submit even handler can remove the text before it is submitted. Just saying 😄 .. Right now i am managing by making the server code ignore all the placeholder text.

@lawrenceyarham
Copy link

I'm seeing this also. It happens if I do the following in IE9 only:
Click on the field that has the placeholder (Placeholder text is correctly removed).

Type some text
Delete all the text
Keep the text cursor in the same field but move the mouse pointer around the rest of the web page. I'm guessing that a blur or focus event occurs that then causes the placeholder text to be put back in the input box. If I now type, then I have a value and the placeholder text and this can also then be submitted to the server.

I'd really appreciate any help/insight on this please.

Many thanks

@dezudas
Copy link

dezudas commented Feb 18, 2015

Going through the same issue

@lawrenceyarham
Copy link

It looks to be a blur/focus or a timeout occurring when the mouser pointer is somewhere else on the page and the text cursor is still in the cell. I'd tried adding some logic to try and detect where the text cursor is when one of those events occurs, but haven't been successful. My thinking was that if we could tell that the text cursor was still in the input/textarea then we could prevent the placeholder from being shown again.

@bambams
Copy link

bambams commented Aug 10, 2015

I noticed this problem too. We're using it in an ASP.NET MVC application with MVC AJAX forms. The placeholder value arrives on the server so I check for it explicitly and filter it out.

@jcrben
Copy link

jcrben commented Nov 2, 2015

Is it possible this is fixed already? I've been trying to trigger it unsuccessfully. I noticed 57375b3 is described as "Fix set hook and clearPlaceholder error". 4902ebe seems even more relevant.

It seems like it should be quite possible to do what @lawrenceyarham is saying and check to see if the focus is on the input field.

@conradkleinespel
Copy link

I'm experiencing the same issue. Seems to be related to me using a custom submit event on my forms. Specifically, I'm thinking that having a custom submit event conflicts with this part of jquery-placeholder.

@conradkleinespel
Copy link

To add to my previous comment, here's a fix that works for me. It seems to be what jquery placeholder expects you to do if you have custom submit handlers. It uses jquery event namespaces.

$('form').submit(function (e) {
    e.preventDefault();

    // custom logic here ...

    $(this).trigger('submit.placeholder');

    this.submit();
});

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

6 participants