Placeholder text gets submitted to the server.
arunkumr opened this issue · 7 comments
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.
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
Going through the same issue
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.
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.
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.
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.
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();
});