Re: QF/QFC - odd behaviour?
| From: | Markus | Date: | Tue, 14 Oct 2003 16:53:13 +0000 |
| Subject: | Re: QF/QFC - odd behaviour? | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-8436@lists.php.net to get a copy of this message | ||
Hi Alexey!
I actually wrote to Bertrand about this too some days ago. Havn't heard
anything yet. Maybe you have some comments about the fix(?) below.
Thanks
/Markus
Here is the essence of what I wrote:
--
I'm not sure if the behaviour of the small example in the attachment
actually is a bug - you tell me. The problem is about values being overrided
by submitted ones. Please run the small example in the attachment.
Solution?
Even though I havn't detected any side effects from my (quite limited) tests
I'm not sure there isn't. Edit HTML_QuickForm_element::onQuickFormEvent() to
prevent it from overriding values set by, for example,
HTML_QuickForm_textarea::setValue(), with submitted values.
***************************************************************
function onQuickFormEvent($event, $arg, &$caller)
{
switch ($event) {
...
case 'updateValue':
// constant values override both default and submitted ones
// default values are overriden by submitted
$value = $this->_findValue($caller->_constantValues);
if (null === $value) {
$value = $this->getValue(); // *NEW ROW*
if (null === $value) { // *NEW ROW*
$value = $this->_findValue($caller->_submitValues);
if (null === $value) {
$value = $this->_findValue($caller->_defaultValues);
}
} // *NEW ROW*
}
if (null !== $value) {
$this->setValue($value);
}
break;
...
}
return true;
} // end func onQuickFormEvent
***************************************************************
begin 666 QFC_test.php.txt
M/#]P:' -"B\J*@T*("H@17AA;7!L92!F;W(@<VAO=VEN9R!O9&0@8F5A=FEO
M=7(@:6X@2%1-3%]1=6EC:T9O<FU?0V]N=')O;&QE<CH@=7-I;F<-"B J("1E
M;&5M96YT+3YS971686QU92@I('=H96X@=&AE<F4@87)E(&%N>2!C;VYS=&%T
M<R!O<B!D969A=6QT<R!W:6QL( T*("H@:&%V92!N;R!E9F9E8W0N#0H@*B -
M"B J(%1H:7,@;6EG=&@@8F4@82!R97-U;'0@;V8@=&AE(&EM<&QE;65N=&%T
M:6]N(&]F(" -"B J($A434Q?475I8VM&;W)M7T5L96UE;G0Z.F]N475I8VM&
M;W)M179E;G0H*2 _(2 -"B J( T*("HO#0IR97%U:7)E7V]N8V4@)TA434PO
M475I8VM&;W)M+T-O;G1R;VQL97(N<&AP)SL-"G)E<75I<F5?;VYC92 G2%1-
M3"]1=6EC:T9O<FTO06-T:6]N+T1I<W!L87DN<&AP)SL-"G-E<W-I;VY?<W1A
M<G0H*3L-"@T*8VQA<W,@4VEM<&QE4&%G92!E>'1E;F1S($A434Q?475I8VM&
M;W)M7U!A9V4-"GL-"B @("!F=6YC=&EO;B!B=6EL9$9O<FTH*0T*(" @('L-
M"B @(" @(" @)'1H:7,M/E]F;W)M0G5I;'0@/2!T<G5E.PT*(" @("
@(" D
M=&5X=" ])B D=&AI<RT^861D16QE;65N="@G=&5X=&%R96$G+"
G='-T5&5X
M="<L("=0;&5A<V4@96YT97(@<V]M971H:6YG.B<L("=R;W=S/3@@8V]L<STT
M,"<I.PT*(" @(" @("
D=&5X="T^<V5T5F%L=64H(DQA<W0@961I="!A=#H@
M(BYD871E*"=(.FDZ<R<I+B)<;B(N)'1E>'0M/F=E=%9A;'5E*"DI.PT*("
@
M(" @(" D=&AI<RT^861D16QE;65N="@G<W5B;6ET)RP@)'1H:7,M/F=E=$)U
M='1O;DYA;64H)V%D9%]E9&ET7W1I;64G*2P@)T%D9"!E9&ET('1I;64G*3L-
M"B @(" @(" @+R\@*BHJ(%5N8V]M;65N="!A;GD@;V8@=&AE<V4@=VEL;"!C
M875S92!T:&4@9F]R;2!T;R!M:7-B96AA=F4A("HJ*B @( T*(" @(" @(" O
M+R D=&AI<RT^<V5T0V]N<W1A;G1S*&%R<F%Y*"=D=6UM>2<@/3X@)T$@8V]N
M<W1A;G0@5F%L=64G*2D[#0H@(" @(" @("\O("1T:&ES+3YS971$969A=6QT
M<RAA<G)A>2@G9'5M;7DG(#T^("=!(&1E9F%U;'0@5F%L=64G*2D[(" @(" @
M(" -"B @("!]#0H@(" @#0I]#0H-"B1P86=E(#TF(&YE=R!3:6UP;&5086=E
M*"=P86=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