Re: Re: upgrade-all broke something

From: Date: Fri, 06 Oct 2006 18:06:26 +0000
Subject: Re: Re: upgrade-all broke something
References: 1 2 3 4 5  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-25374@lists.php.net to get a copy of this message
On 10/6/06, Troy Cregger <tcregger@kennedyinfo.com> wrote:
Thanks for the advice. Not sure if I can use the setDefaults() function with the way this code is written, at least without changing a bunch of other stuff. I'll have to check into that.
setDefaults() can be called multiple times with different element names (key values).
T. Justin Patrin wrote: On 10/6/06, Troy Cregger <tcregger@kennedyinfo.com> wrote: Please respond in-line.
Yup, it works with the previous version.. I just installed HTML_QuickForm 3.2.5 and that fixed the problem. Now... how do I find out what the reason for this is? I'm fairly new to PEAR but am willing to contribute in any way I can. Later (when I'm not at work) I'll document this experience, maybe it will help others. Here's the simple version. (typo corrected this time) In the source php file I have something like: $t = &HTML_QuickForm::createElement('checkbox', 'Check:', 'Select', null,
                                    array('checked' => '', 'onClick'
=> 'javascript:update();', 'class' => 'checkbox'));
As others have said, you should be usin setDefaults(), not setting the checked attribute manually.
The update() function referenced above is in a smarty template. HTML_QuickForm 3.2.5 calls the function and the form 'updates' with the new values, details about the JS I don't think are relevant since the problem is that in HTML_QuickForm 3.2.6 the script does not execute at all.
The first thing you should do it view the source on the generated form. Compare the 2 and try to see if the attributes are the same and that your JS is even in the page. Once you've figured this out you can backtrack what code is making the problem happen.
Thanks for the help, and if I happen to find out why this happened I will post it. T. Troy Cregger wrote:
Hmm good point... I inherited this code from a previous developer so I didn't see the typo. Thanks for pointing that out. Trying it now. Nope... still not working. The elements are checked when the form loads... This was working with the last version HTML_QuickForm 3.2.5 stable
but
not now with HTML_QuickForm 3.2.6 stable Wondering if there's a change in the way I have to call the script? Bertrand Mansion wrote:
Troy Cregger wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 sorry, code is here. $t = &HTML_QuickForm::createElement('checkbox', 'ckItem', 'Select:', null, array('checked' => '', 'onClick' => 'javscript:update();',
'class'
=> 'checkbox'));
I doubt it can work with 'javscript:' ... Furthermore, you should use setDefaults() to set the checked
status of your
element, but that's up to you.
-- Justin Patrin

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