Page 1 of 1

Date issue.

Posted: Tue May 25, 2004 10:06 am
by wafasn
Hi everyone,

I hope someone can help me with this:

I have a web page where user can search for an event by date(start_date). the page contains a textbox linked to a calnedar. When the user clicks on the calendar, this one popups, he select a date that goes to the textbox.
What I want to do is to prevent user from typing a date directley to the textbox. I used the property "disabled" for the textbox, it works fine but when I send data to another page"search.php" through the POST method, the variable "start_date" is empty.

here is the code:

<form name="dateForm" action="post" action="search.php">
<td width="62"><input type='text' name='start_date' disabled size='10'>
</td>
<td width="24"><a href="javascript:void(0)" onClick="showCalendar(dateForm.start_date,'yyyy/mm/dd','Choose date')">
<img src="../../images/calendar.gif" BORDER="0" width="23" height="23"></a>
</td>
<td width="31"><input name="go" type="submit" value="Go"></td>
</form>


Thanks in advance.

Posted: Tue May 25, 2004 10:07 am
by launchcode
Put the date value to a hidden form field and just display it (rather than in a text field) ?

Posted: Tue May 25, 2004 10:27 am
by Wayne
or if you want to display the date input area you should be able to use readonly instead of disabled.

Posted: Tue May 25, 2004 10:33 am
by pickle
Ya, I do this all the time in my applications, and you "readonly" is definitely what works.