Issue with jquery.datepicker

I have a form where I'm using jquery.datepicker. In the input field I have a default vaule of "Occupancy Date" that is causing a javascript error since it's not the "mm/dd/yyyy" format called for by the script. Is there anyway around this?
tekgrlAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

onlyaymieCommented:
Since you didn't post your code, this is pretty general...

You could clear the default text out on the onfocus, put something like this in your $(document).ready

$(".form_date").focus(function() {
var val = $(this).val();
if( val === "Occupancy Date" )
{
$(this).val("");
}
});
0
tekgrlAuthor Commented:
That didn't work. My code is attached. Teh weird thing is that the error comes up on page load not on form submit.
<script type="text/javascript" charset="utf-8">
	Date.firstDayOfWeek = 0;
	Date.format = 'mm/dd/yyyy';
	$(function()
	{
		$('.date-pick').datePicker()
	});
</script>
</head>
<body id="contact">
	<div id="form-wrapper">
		
		<form class="cmxform" id="commentForm" name="contactform" method="post" action="send-form.php" target="_self">
		
			<img src="images/head-contact-us.png" width="92" height="14" alt="contact us" style="padding-bottom: 7px;">

						<div>
				<input  type="text" name="firstName" id="firstName" class="required" maxlength="50" size="20" value="First name" onclick="this.select()">
			</div>
			<div>
				<input  type="text" name="lastName" id="lastName" class="required" maxlength="50" size="20" value="Last name" onclick="this.select()">
			</div>
			<div>
				<input  type="text" name="phone" id="phone" class="required" class="phone" maxlength="12" size="20" value="Phone number" onclick="this.select()">
			</div>
			<div>
				<input  type="text" name="email" id="email" class="required email" maxlength="80" size="20" value="Email address" onclick="this.select()">
			</div>
			<div style="padding-bottom: 11px;">
				<select name="size" class="styled" />
    				<option value="studio">Studio</option>
					<option value="1bed">1 Bedroom</option>
					<option value="2bed">2 Bedroom</option>
				</select>
			</div>
						<div>
							<input name="date1" id="date1" class="date-pick" maxlength="10" value="Date of Occupancy" onclick="this.select()" style="width: 139px;" />
						</div>
			<div style="padding-bottom: 7px;">
				<textarea name="comments" cols="30" rows="2" maxlength="400">Comments</textarea>
			</div>
			<input type="image" src="images/btn-submit-off.png" class="btn" value="Submit" alt="Submit">
		
	</form>			
			
	</div>
</body>

Open in new window

0
onlyaymieCommented:
in your script, the capitalization is wrong and you are missing a ;

should be:

	$(function()
	{
	 	var what = $('.date-pick');
		$('.date-pick').datepicker();
	});

Open in new window

0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

onlyaymieCommented:
oops, the what was my debugging...

	$(function()
	{
		$('.date-pick').datepicker();
	}); 

Open in new window

0
tekgrlAuthor Commented:
Still having the original issue with default value.
0
onlyaymieCommented:
please see http://jsfiddle.net/EU8rP/2/ - it works and ignores and overwrites the default value
0
tekgrlAuthor Commented:
When I put that code in I got an error on this line:

 $('.date-pick').datepicker();
Object doesn't support this method or property

When I change datepicker back to datePicker I get the original error on the date.js file.
0
onlyaymieCommented:
Hm.  Maybe you have more than one problem.  I just went with the code you posted, and the error I was getting was Object doesn't support this method or property where the capitalization on datepicker was incorrect.  Fixing that fixed the problem for me and made the calendar work (as seen in the jsfiddle example).  Do you have other code you are using in addition to what you posted?
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.