I’ve looked at posts that ask how to do this, but I’m new to JQuery so I may be missing something that would help with how my form is set up.
I have a classic asp page with a search box that has a watermark “Employee Last Name” in the text box. I want to validate this field as required. The watermark is working fine, and the validation works fine, but won’t validate properly if the watermark is there. I guess it’s seeing the watermakr as an entered value?
Any tips on how I can keep my watermark and still validate this field? Here’s the code I’m using:
<script type="text/javascript">
//Form watermarks
$(document).ready(function() {
$('.watermarked_title').watermark('watermark');
});
</script>
<script>
//Validation
jQuery(document).ready(function(){
// binds form submission and fields to the validation engine
jQuery("#SearchForm").validationEngine();
});
</script>
Form code:
<form action="EmpSearch.asp" method="Post" id="SearchForm">
<input name="SearchLN" id="SearchLN" type="text" size="22" class="validate[required] searchBox watermarked_title" title="Employee Last Name" >
<input type="submit" class="button" Value="Search">
</form>
The watermark value should be cleared before submit:
If you use it right…:
source