Re: HTML_Quick FORM populating default data
| From: | Atif Khan | Date: | Fri, 17 Mar 2006 23:44:25 +0000 |
| Subject: | Re: HTML_Quick FORM populating default data | ||
| References: | 1 2 3 4 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-23332@lists.php.net to get a copy of this message | ||
Here is the HTML source. I cleaned up all the array options so its easier to read.
Notice the default I set only for w_phone[areacode], but it populates it on h_phone also.
$ClientForm_obj->setDefaults(array('fname' => $fname,
'zip_postal' => $zip_postal,
.... etc
'w_phone[areacode]' => '654'));
<tr>
<td align="right" valign="top"><b>Work Phone:</b></td>
<td valign="top" align="left">
<input size="4" maxlength="3" name="w_phone[areacode]" type="text" value="654" /> - <input size="4" maxlength="3" name="w_phone[prefex]" type="text" /> - <input size="4" maxlength="4" name="w_phone[number]" type="text" /></td> </tr> <tr> <td align="right" valign="top"><b>Home Phone:</b></td> <td valign="top" align="left">
<input size="4" maxlength="3" name="h_phone[areacode]" type="text" value="654" /> - <input size="4" maxlength="3" name="h_phone[prefex]" type="text" /> -
<input size="4" maxlength="4" name="h_phone[number]" type="text" />
</td>
</tr>
Here is the rest of the code.
/***********************************************************************************************
$areaCode = $ClientForm_obj->createElement('text', 'areacode', null, array('size' => 4, 'maxlength' => 3,
'onfocus' => 'this.style.backgroundColor="f4f4e6"',
'onblur' => 'this.style.backgroundColor="ffffff"'));
$phoneNo1 = $ClientForm_obj->createElement('text', 'prefex', null, array('size' => 4, 'maxlength' => 3,
'onfocus' => 'this.style.backgroundColor="f4f4e6"',
'onblur' => 'this.style.backgroundColor="ffffff"'));
$phoneNo2 = $ClientForm_obj->createElement('text', 'number', null, array('size' => 4, 'maxlength' => 4,
'onfocus' => 'this.style.backgroundColor="f4f4e6"',
'onblur' => 'this.style.backgroundColor="ffffff"'));
$ClientForm_obj->addGroup(array($areaCode, $phoneNo1, $phoneNo2), 'w_phone', 'Work Phone:', ' - ');
$ClientForm_obj->addGroup(array($areaCode, $phoneNo1, $phoneNo2), 'h_phone', 'Home Phone:', ' - ');
$ClientForm_obj->addGroup(array($areaCode, $phoneNo1, $phoneNo2), 'c_phone', 'Cell Phone:', ' - ');
/***********************************************************************************************
Thanks
Atif K