Solved

jquery datepicker sending current date if input empty

Posted on 2010-08-26
3
460 Views
Last Modified: 2012-05-10
hello
can anyone tell me why datepicker submits the current date if the input field is empty? this date field is not a compulsory field and can be used at the users discretion. many thanks.
0
Comment
Question by:peter_coop
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 15

Accepted Solution

by:
dirknibleck earned 250 total points
ID: 33537853
I've never experienced this. Are you sure that the page itself is submitting the current date?

Is your server side PHP? If you use code like: date('Y/m/d', strtotime($_POST['date'])) and $_POST['date'] is blank, I believe strtotime will calculate the current date at the server...
0
 

Author Comment

by:peter_coop
ID: 33540086
thanks for reply. this is the php code:

$date_parts = explode("/",$_POST['datepicker']);
$newDate = $date_parts[2]  . "-" . $date_parts[1] . "-" . $date_parts[0];
$datepicker = date('Y/m/d', strtotime($newDate));
0
 

Author Closing Comment

by:peter_coop
ID: 33541800
thank you
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question