Quickform: IP address representation

From: Date: Mon, 21 Jun 2004 18:29:58 +0000
Subject: Quickform: IP address representation
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-13234@lists.php.net to get a copy of this message
Hello, I'm using HTML_QuickForm and I'm trying to represent an IP address. There are a few things that I need to happen in order for this to work: 1. I need 4 text boxes through which the user can enter each of the 4 octets of the IP address. 2. I need to validate the IP address, making sure that it is non-empty, totally numeric, and that all of the values are between 0 and 255. 3. I need the validation to be done client-side so that the user has the opportunity to fix the problem before submitting the page. 4. If there is more than one error in a single IP address, I only want one error to be displayed. So, if the user enters an IP address of '300.300.300.300', I only want one message to be displayed, not four. 5. I need a period to be placed between each of the text boxes. 6. I also need to be able to control what the IP address looks like by using my own templates. I've gotten close to fully implementing this, but I've run into a bit of a problem. So far I've created 4 text boxes, created a group template and a groupElement template, and added all 4 text boxes to the group. By doing this I'm able to satisfy nearly all of the requirements I need, but the 5th one (dots between the ip addresses) doesn't seem possible. If I was able to specify the templates for individual elements within the group, it would be possible. Also, if I was able to specify a separator for a group _and_ set a grouptemplate, it would be possible. I found an old post in the mailing list archives that was fairly relevant: http://marc.theaimsgroup.com/?l=pear-general&m=106266726802796&w=2 Short of implementing my own renderer, is there a solution to my problem? If not, maybe now is a good time to rethink shutting off separators in the default renderer when a grouptemplate has been set. I'll provide a patch if this is the desired behaviour. --Mark. -- /////////////////////////////////////////////////////////////// // // // Mark Drago Phone: 631-434-6600 // // Associate Software Developer Email: mdrago@bascom.com // // BASCOM Global Internet Services, Inc. // // // ///////////////////////////////////////////////////////////////

« previous php.pear.general (#13234) next »