textbox water mark

Last Reply on Apr 30, 2015 09:05 PM By Mudassar

Posted on Apr 30, 2015 09:03 PM

hi

I use below code to putting water mark for textbox

    <script type="text/javascript">
        var defaultText = "Enter Your Text here";
        function WaterMark(txt, evt) {
            if (txt.value.length == 0 && evt.type == "blur") {
                txt.style.color = "#b9b9b9";
                txt.value = defaultText;
            }
            if (txt.value == defaultText && evt.type == "focus") {
                txt.style.color = "black";
                txt.value = "";
            }
        }
    </script>

but when I click on button to insert data into database if I don't type any text in textbox it insert in database defult text :

"Enter Your Text here";

but I want if I don't type anything in textbox it doesn't insert any thing into database

Best Regards

Neda

 

You are viewing reply posted by: Mudassar on Apr 30, 2015 09:05 PM.
Posted on Apr 30, 2015 09:05 PM

Add a checking before Insert

if(TextBox1.Text != ""Enter Your Text here"")
{

}

 

I agree, here is the link: https://www.e-iceblue.com/Introduce/spire-office-for-net-free.html?aff_id=108