Creating a custom form-table with HTML_QuickForm

From: Date: Mon, 16 Feb 2004 14:56:24 +0000
Subject: Creating a custom form-table with HTML_QuickForm
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-10721@lists.php.net to get a copy of this message
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hello, ~ Ok, I'm looking for a little bit of advice on how to approach a particular problem. I want to create a sort of dynamic table with embedded form elements. By dynamic, I mean I want to allow users to add rows to the table. Picture it sort of like this: - ---------------------------------------------------- | Input1a | Input2a | Input3a | Input4a | Input5a | - ---------------------------------------------------- (buttons) - ---------- ---------- |Add Row | | Submit | - ---------- ---------- If the user clicks the Add Row button, the current table gets returned to the user's browswer along with an additional row of form inputs. - ---------------------------------------------------- | Input1a | Input2a | Input3a | Input4a | Input5a | - ---------------------------------------------------- | Input1b | Input2b | Input3b | Input4b | Input5b | - ---------------------------------------------------- - ---------- ---------- |Add Row | | Submit | - ---------- ---------- ~ When I first started to tackle this project, I was going to use just straight PHP. Then I thought "You know, I bet someone out there has a package for being able to easily build complex forms using PHP code and not having to do too much stuff by hand." So I started looking, and that's how I found PEAR. Right now, I'm trying to figure out how best to use PEAR's HTML facilities. ~ One option is to simply use HTML_QuickForm::createElement() to create elements, but then generating the table myself in code that isn't integrated very well with PEAR. With this option, anywhere I want to place an element in my PHP code, I just call $element->toHtml(). ~ That approach would be fairly simple from a design standpoint, but it doesn't seem to make very good use of, or work very well with, the QuickForm package. For example, I'm not really sure that I'd be able to integrate my generated form inside of a larger QuickForm very well. ~ I was looking at the HTML_QuickForm documentation and you guys have the concept of a pseudo-element. I guess what I'm thinking would be the preferable solution is if I can have this data-table be a pseudo-element that could placed within a QuickForm (you'd end up with a table-within-a-table, but it would be all one form then at least). ~ Does the idea of creating this as a new pseudo-element for QuickForm seem appropriate? How would I get started creating a pseudo-element? If so, and I can develop it, would you guys be interested in having me submit it for consideration to be merged with the HTML_QuickForm package? Jeff Schmidt -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.3 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFAMNoW/djDnfAeGysRAoL5AKDvRqb1oBSXKG/kRIN1NrJddEdWUQCfcWOy x3NOI0WJ/MC90jNRTbL/lJ0= =FFK/ -----END PGP SIGNATURE-----

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