PHP Classes

Date Input

Recommend this page to a friend!

      PHP Forms Class with HTML Generator and JavaScript Validation  >  PHP Forms Class with HTML Generator and JavaScript Validation package blog  >  Locating addresses on...  >  All threads  >  Date Input  >  (Un) Subscribe thread alerts  
Subject:Date Input
Summary:Wrong XHTML
Messages:3
Author:Matías montes
Date:2006-11-15 15:55:37
Update:2006-11-15 21:12:43
 

  1. Date Input   Reply   Report abuse  
Picture of Matías montes Matías montes - 2006-11-15 15:55:37
The date input creates an empty option in the selects with the following format:
<option value=""></option>
This is not valid XHTML, as the option tag cannot be empty.
I fixed it by using a non-breaking space character (ALT + 0160) which the forms class then escapes to the &nbsp; entity:
<option value="">&nbsp</option>

Also, i was considering that it would be great if a date could be validated against the date set in another input.
For instance, I have two date fields called "start_date" and "end_date" and I wish to validate that "end_date" must be a later date than "start_date".
I think it would be a great upgrade.

Thanks

  2. Re: Date Input   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2006-11-15 17:46:18 - In reply to message 1 from Matías montes
Are you sure? I tried using W3C XHTML validator and it does not complain when I send a page like what follows below.

As for validating date ranges with values from other inputs, it is a good idea. I have had requests but I have not had time to do it.

Feel free to send me patches to implement it if you would like to go ahead before I have time to do it myself.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>Test</title>
</head>
<body>
<form method="get" action="">
<div><select name="test" id="test">
<option value=""></option>
</select></div>
</form>
</body>
</html>

  3. Re: Date Input   Reply   Report abuse  
Picture of Matías montes Matías montes - 2006-11-15 21:12:43 - In reply to message 2 from Manuel Lemos
My bad, you were right about the w3c validation. I was getting warning messages in the tidy plugin for firefox and assumed it was wrong XHTML.

My apologies