Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
BOOK: Professional Ajax ISBN: 978-0-471-77778-6
This is the forum to discuss the Wrox book Professional Ajax by Nicholas C. Zakas, Jeremy McPeak, Joe Fawcett; ISBN: 9780471777786
Important: For the new 2nd edition of this book, please post here instead: [url="http://p2p.wrox.com/forum.asp?FORUM_ID=307"]http://p2p.wrox.com/forum.asp?FORUM_ID=307[/url]
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional Ajax ISBN: 978-0-471-77778-6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old April 21st, 2006, 08:01 PM
Registered User
Join Date: Apr 2006
Location: Oakland, CA, .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Incremental Form Validation Example

Just starting to use XMLHttp-style Ajax.
I have also just started using PHP.
I tried the Incremental Form Validation Example (downloaded the code from Wrox).
The E-mail and Username fields validate OK (and display errors when appropriate).
The Birthday field does not validate correctly. Whatever garbage I type in is just accepted.
Environment is WindowsXP/IE6.0/IIS5.0/PHP5.1(ISAPI).

Also - what is a recommended debugger for Ajax/PHP/IIS development?
  #2 (permalink)  
Old April 22nd, 2006, 02:37 PM
nzakas's Avatar
Wrox Author
Join Date: Dec 2004
Location: Peabody, MA, USA.
Posts: 217
Thanks: 0
Thanked 5 Times in 5 Posts

Sorry, there is no way to tell from your description what the problem could be. I'd suggest looking at the PHP page, which was designed for PHP 4. See what the output of this section is:

        $date = strtotime($_GET["txtBirthday"]);
        if ($date < 0) {
            $message = "This is not a valid date.";
        } else {
            $valid = "true";
            $message = "";

Nicholas C. Zakas
Author, Professional JavaScript for Web Developers (ISBN 0764579088)
  #3 (permalink)  
Old April 22nd, 2006, 03:58 PM
Registered User
Join Date: Apr 2006
Location: Oakland, CA, .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts

> designed for PHP 4
In <http://www.php.net/strtotime> it says that strtotime returns a timestamp on success, FALSE otherwise. Previous to PHP 5.1.0, this function would return -1 on failure.

So I changed
if ($date < 0)
if ($date === false)
and all is well.

Similar Threads
Thread Thread Starter Forum Replies Last Post
Standalone validation + web form validation morbo Struts 0 August 19th, 2008 04:02 AM
Form Validation Help jonsey Javascript 0 April 25th, 2007 08:14 AM
Validation of Form qazi_nomi Javascript 5 August 2nd, 2004 03:49 PM
Form not refreshing after form validation Mimi Javascript How-To 0 August 25th, 2003 03:20 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.