Re: Re: [PEAR] horizontal formbuilder

From: Date: Fri, 20 May 2005 23:52:43 +0000
Subject: Re: Re: [PEAR] horizontal formbuilder
References: 1 2  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-19337@lists.php.net to get a copy of this message
On May 20, 2005, at 6:10 PM, Justin Patrin wrote:
On 5/20/05, Andrew Wooldridge <andrew.r.wooldridge@vanderbilt.edu> wrote:
Justin et. al, please advise. Currently writing a form using formbuilder to insert multiple rows in a single table with one form using the useForm() method. Look at the example below of what I want the form to look like. Should I write my own getForm(), or is there a way to customize with pre/postGenerateForm() to output everything horizontally on one line? Thanks! -Andy I want the HTML code to look like:
        <tr>
                 <td align="right" valign="top"><b>Checkbox1</b></td>
                 <td align="right" valign="top"><b>Checkbox2</b></td>
                 <td align="right" valign="top"><b>Checkbox3</b></td>
         </tr>
        <tr>
                 <td valign="top" align="left"><input name="field1[1]"
type="checkbox" value="1" id="qf_6dd127" /></td>
                 <td valign="top" align="left"><input name="field2[1]"
type="checkbox" value="1" id="qf_d0b905" /></td>
                 <td valign="top" align="left"><input name="field3[1]"
type="checkbox" value="1" id="qf_030dd7" /></td>
         </tr>
        <tr>
                 <td valign="top" align="left"><input name="field1[2]"
type="checkbox" value="1" id="qf_6dd127" /></td>
                 <td valign="top" align="left"><input name="field2[2]"
type="checkbox" value="1" id="qf_d0b905" /></td>
                 <td valign="top" align="left"><input name="field3[2]"
type="checkbox" value="1" id="qf_030dd7" /></td>
         </tr>
         <tr>
                 <td align="right" valign="top"><b></b></td>
                 <td valign="top" align="left"><input name="__submit__"
value="Submit" type="submit" /></td>
         </tr>
Not like FormBuilder default getForm which outputs:
        <tr>
                 <td align="right" valign="top"><b>Checkbox1</b></td>
                 <td valign="top" align="left"><input name="field1[1]"
type="checkbox" value="1" id="qf_6dd127" /></td>
         </tr>
         <tr>
                 <td align="right" valign="top"><b>Checkbox2</b></td>
                 <td valign="top" align="left"><input name="field2[1]"
type="checkbox" value="1" id="qf_d0b905" /></td>
         </tr>
         <tr>
                 <td align="right" valign="top"><b>Checkbox3</b></td>
                 <td valign="top" align="left"><input name="field3[1]"
type="checkbox" value="1" id="qf_030dd7" /></td>
         </tr>
        <tr>
                 <td align="right" valign="top"><b>Checkbox1</b></td>
                 <td valign="top" align="left"><input name="field1[2]"
type="checkbox" value="1" id="qf_6dd127" /></td>
         </tr>
         <tr>
                 <td align="right" valign="top"><b>Checkbox2</b></td>
                 <td valign="top" align="left"><input name="field2[2]"
type="checkbox" value="1" id="qf_d0b905" /></td>
         </tr>
         <tr>
                 <td align="right" valign="top"><b>Checkbox3</b></td>
                 <td valign="top" align="left"><input name="field3[2]"
type="checkbox" value="1" id="qf_030dd7" /></td>
         </tr>
         <tr>
                 <td align="right" valign="top"><b></b></td>
                 <td valign="top" align="left"><input name="__submit__"
value="Submit" type="submit" /></td>
         </tr>
First and foremost, FormBuilder doesn't support elements with [ or ] in their names, Second, FormBuilder builds forms for DB_DataObjects and I've never seen a field name in a DB with [ or ] in it. Third, what you're building here looks like a tripleLink. I suggest you look more into that. The Audio Formats element on th epage below is a tripleLink: http://pear.reversefold.com/ You can get an example here: http://pear.reversefold.com/example.tgz -- Justin Patrin
Thanks for the pointers. You're absolutely correct about the bracket characters. I was modifying the names of the dataobject elements to make an HTML array per the first example on this page: http://lists.nyphp.org/pipermail/front-end/2004-February/000196.html. I think tripleLink is the more elegant solution that I'm looking for. Follow-up Question: If I need more field types than just checkboxes in each row, then I should use crosslinks, like the 'Songs' in your example? -A

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