How to prevent watermark text being sent when a button is clicked?

I've implemented this textbox watermark functionality on some of the text boxes in my solution:

http://cysemic.com/2010/03/jquery-textbox-watermark-revisited-making-it-a-plugin/

It's very useful, but it's causing me some problems. Specifically, when I click the submit button when the watermark is present on a text box, the watermark text gets sent to the server. This means I have to do a test on the server to see if that text got sent, which isn't ideal.

could somebody suggest a client-side solution to this? So that when I click a button or a link which would normally end up bringing the text from the page to the server, that this is filtered out and nothing happens?

Answers


Propably not the best solution even (as I don't know what you're using on the server) but you may intercept the submit event and block the default behaviour (submit) if the value is empty or equal to the watermark text.


I think it would be better to place the watermark text by positioning it absolutely on top of the field you want to watermark. There is a plugin I developed called Watermarkify which does that. It also animates the watermark upon focus.

Demo : http://www.ajaybalachandran.com/demo/watermarkify/

Download : http://www.ajaybalachandran.com/blog/48/watermarkify-jquery-twitter-like-animated-textfield-watermarks/


Need Your Help

The best way configurate identity server 5.1.0 as LDAP server and test the connection

java server ldap wso2is

How can I configurate the identity server to work as LDAP server? how can I test the ldap server with connection (in java) to create and authenticate users?

Core Animation: Do an animation only on a specified-portion of a layer (iOS)

ios animation core-animation calayer

I'm pretty much desperate here looking for a way to add an animation to a CALayer but make it apply only to a part of the layer. Or if it's even possible.