RE: HTML_QickForm > AdvMultiselect
| From: | Mark Steudel | Date: | Fri, 19 Sep 2008 16:25:16 +0000 |
| Subject: | RE: HTML_QickForm > AdvMultiselect | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-29275@lists.php.net to get a copy of this message | ||
Hi Laurent,
Thanks for your help, that was definetly the problem. Because I don't have
access to the server to install PEAR, I just tried copying my whole PEAR
directory up there and linked to it that way, I both missed uploading the js
file, and had the path to the js from my local machine.
BTW wasn't there a nother project going on to install PEAR libraries via a
web browser?
MS
-----Original Message-----
From: Laurent Laville [mailto:pear@laurent-laville.org]
Sent: Thursday, September 18, 2008 11:16 PM
To: Mark Steudel
Cc: pear-general@lists.php.net
Subject: Re: HTML_QickForm > AdvMultiselect
Mark Steudel a écrit :
> I am using the advmulti select for quickform and it is working fine on
> my laptop (windows xp, apache, php 5+, mysql) . But when I upload my
> code to the linux box and the javascript doesn't print out. Here's a
> set of test code that demonstrates the problem:
>
> $form = new HTML_QuickForm( 'groupForm' );
>
> $renderer =& $form->defaultRenderer();
>
> // apply classes
>
> $alignLeft = "\n\t<tr>\n\t\t<th align=\"right\"
> valign=\"top\"
> class=\"align_right\"><!-- BEGIN required --><span style=\"color:
> #ff0000\">*</span><!-- END required
> --><b>{label}</b></th>\n\t\t<td
> valign=\"top\" class=\"align_left\"><!-- BEGIN error --><span
style=\"color:
> #ff0000\">{error}</span><br /><!-- END error
> -->\t{element}</td>\n\t</tr>";
>
> $renderer->setElementTemplate($alignLeft);
>
> $form->addElement( 'advmultiselect', 'markets', 'Markets: ',
> array(
> 'test', 'test2', 'test3') );
>
> echo $form->toHTML();
>
>
> Here's part of the html that is spit out:
>
> <tr>
> <th align="right" valign="top"
> class="align_right"><b>Markets: </b></th>
> <td valign="top" class="align_left">
> <script type="text/javascript">
> //<![CDATA[
>
> //]]>
> </script>
>
> <table border="0" cellpadding="10"
> cellspacing="0"><tr>
> <td valign="top"><select name="markets-f[]"
> multiple="multiple"
size="10"
> style="width:100px;" id="markets-f"
> ondblclick="qfamsMoveSelection('markets',
> this.form.elements['markets-f[]'],
> this.form.elements['markets-t[]'], this.form.elements['markets[]'],
> 'add', 'none')">
>
> <option value="0">test</option>
> <option value="1">test2</option>
> <option value="2">test3</option>
> </select></td>
>
>
> Thanks in advance, Mark
>
Hi Mark,
Do you have installed the package with PEAR installer or copy it by hand ?
If you have copied it by hand you have forgotten to make replacements that
PEAR installer did it for you :
See function,
lines 928-949 of advmultiselect.php,v 1.18 2008/04/26 17:37:00 Without
replacement of @data_dir@ and @package_name@ you get empty value (line 937:
$js = '')
function getElementJs($raw = true)
{
$js = '@data_dir@' . DIRECTORY_SEPARATOR
. '@package_name@' . DIRECTORY_SEPARATOR
. 'qfamsHandler.js';
if (file_exists($js)) {
$js = file_get_contents($js);
} else {
$js = '';
}
if ($raw !== true) {
$js = '<script type="text/javascript">'
. PHP_EOL . '//<![CDATA['
. PHP_EOL . $js
. PHP_EOL . '//]]>'
. PHP_EOL . '</script>'
. PHP_EOL;
}
return $js;
}
Regards
Laurent Laville