25.6 C
Singapore
Friday, November 15, 2024
HomeBlogSite UpdatesNew Video and Portfolio Section up

New Video and Portfolio Section up

Form Error Reporting

Site Updates
As part of my planned holiday chores, spent time over the last few days revamping and fixing up parts of the site. The videos page now has the videos streamed from youtube and google video, so no hassles to download them for viewing anymore, freeing up alot of server space for the site as well. Did some miscellaneous cleaning up of the site’s core code for W3C compliance, with the exception of IE7.0 screaming at every single “error” it encounters – code with Firefox breezes through with ease and speed.

The portfolio page is also revamped with a new look and updated sections, noticeably the interactive mouse overs and the quotation request form, which I’ve spent the last 3 whole days altogether coding and testing. Personally I think it looks fabulous with the exception of some more code tweaking in the background to speed up browsing in some areas.

Email contact code
Powering the quotation request page of the portfolio section is an email contact form. It’s very hard to find good free email programs are all very basic, they are either cgi or simple php files with basic functions and userablity. So I decided to write a whole custom contact form scratch and put it up for testing on the pages:

Little basic run down on of the contact code.
One PHP file is used for input, verification and submission. In other words, it basically calls itself back with an identifier when there are any error(s), preserving all the submitted field data and not having to retype the form again. It’s like and instant redirection back to the form if a user misses out and required fields, unlike conventional forms which will “tell the user to go back and fix the problem”. I personally find this user-friendly aspect lacking in most free code which depends on browser back button and cache to retrieve back field information which does not always work. A success submit will yield a success message and the done option to close the form altogether.

Form Success Message
Success Message
Email Sent
Sent Email Format

Moreover, the form even lists down the errors in a numbered list with the missing field boxes highlighted so that the user knows where to go from there. Other features include:

  • Active hover tooltips for fields which requires explanation
  • Optional no direct access to form itself (against spam bots)
  • Auto loading of different custom form field templates for different categories
  • Field conditions (e.g. if “others” is specified it’s required to specify)
  • Valid email checking
  • Antispam fields with image verification
  • IP, referrer and client browser logger
  • Able to log requests in a log textfile or database
  • Mail sent through PHP mail() or SMTP

The whole software comes in 3 files, with the main PHP file weighing in with 500 lines of code, coupled with a .js file for the javascript tooltips and a CSS stylesheet for form styling.

I will leaving the form to run on the site testing before looking to release the contact form under a GPL. Also after I go about cleaning the source code and making it more modular as it is currently hardcoded to fit some specific form fields my site is currently using. Come worse to worse if I am unable to do so, I will just release the code “as it is” for ya all coders to pounce on and start dissecting.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles