Andy Pieters wrote:
Hi List
I am quite experienced in PHP. I have been asked to design a complicated form
in php that spans multiple pages and has many subitems. For instance if they
select one checkbox, more details are required in the form of a dropdown list
or radio buttons.
It would allow browsing the different pages randomly, and final validation is
only to be performed on the last page. In case of errors, it would load the
page where the first error is found and display a message and highlight the
faults.
I currently made a list of all vars in an xml file, and associated a page
number for each. Now when the page loads it looks up the vars used on that
page and loads them from post (if present and stores them in session right
away) or loads them from session if no post is present.
Any ideas for improvements, common pitfalls, etc are highly appreciated.
With kind regards
Andy
You may want to consider a mixed AJAX and clientside javascript
validation. Requiring the user to go through a complex form and delay
validation until the end may fustrate users. I would avoid putting
business rules into the clientside javascript, but it would be
reasonable to check for things like valid dates, required fields
completed etc. You can also use simple clientside javascript to create
or expose appropriate dropdowns as needed. In this case of items where
more complex business rules need to be validated you can hit the backend
via AJAX (XML over http) to load further clientside rules or perform
autocompletion (e.g. zipcode to city state lookup). See googles suggest
site for example of autocompletion approach. Since you are already in
the XML world, you may want to consider creating your page via an XSLT
transform of an XML representation of the data.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php