FAQ
Edit report at https://pear.php.net/bugs/bug.php?id=19802&edit=1

  ID: 19802
  Updated by: borz_off@cs.msu.su
  Reported By: borz_off at cs dot msu dot su
  Summary: Repeat: content of repeated static elements is
                     cleared
-Status: Open
+Status: Closed
  Type: Bug
  Package: HTML_QuickForm2
  Operating System: Irrelevant
  Package Version: 2.0.0
  PHP Version: Irrelevant
-Assigned To:
+Assigned To: avb
  Roadmap Versions:
  New Comment:

-Status: Open
+Status: Closed
-Assigned To:
+Assigned To: avb
Fixed in Git
https://github.com/pear/HTML_QuickForm2/commit/e17eecae5ba1182e90c738f608091f60ee9b5683


Previous Comments:
------------------------------------------------------------------------

[2013-01-28 20:30:15] avb

Description:
------------
If a static element is added to repeat, its content is effectively
removed when a backupChildAttributes() / restoreChildAttributes() cycle
is performed, as is done in getChildValues(), validate() and render().

getValue() for statics always returns null while setValue() is
equivalent to setContent().

Test script:
---------------
$fieldset = new HTML_QuickForm2_Container_Fieldset();
$repeat = new HTML_QuickForm2_Container_Repeat(
     null, null, array('prototype' => $fieldset)
);
$static = $fieldset->addStatic()
     ->setContent('Content of static element')
     ->setTagName('p');

// force changing of attributes, getValue() or validate() will also work
here
$arrayOne =
$repeat->render(HTML_QuickForm2_Renderer::factory('array'))->toArray();

$arrayTwo =
$repeat->render(HTML_QuickForm2_Renderer::factory('array'))->toArray();

foreach ($arrayOne['elements'] as $fsArray) {
     echo $fsArray['elements'][0]['html'] . "\n";
}
foreach ($arrayTwo['elements'] as $fsArray) {
     echo $fsArray['elements'][0]['html'] . "\n";
}

Expected result:
----------------
<p id="qfauto-2_:idx:">Content of static element</p>
<p id="qfauto-2_:idx:">Content of static element</p>


Actual result:
--------------
<p id="qfauto-2_:idx:">Content of static element</p>
<p id="qfauto-2_:idx:"></p>

------------------------------------------------------------------------

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-bugs @
categoriesphp
postedJun 18, '14 at 7:10p
activeJun 18, '14 at 7:10p
posts1
users1
websitepear.php.net

1 user in discussion

Borz_off: 1 post

People

Translate

site design / logo © 2022 Grokbase