HashanChamara / php-form-builder-class

Automatically exported from code.google.com/p/php-form-builder-class
0 stars 0 forks source link

FIX: openFieldset never uses its second argument, additionalParams #89

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.  add additional params, maybe array('id' => 'myId'), to openFieldset() 
function call
2.  load form into page
3.  check to see if additional params were used?  

What is the expected output? What do you see instead?

i expected to see <feildset id="myId">, but id="myId" wasn't there.  

What version of the product are you using? On what operating system?

mac os x.  pfbc 1.1.2

Please provide any additional information below.

looked at the code for the function:

  public function openFieldset($legend, $additionalParams="") {
    $this->addElement("", "", "htmlexternal", '<fieldset class="pfbc-fieldset"><legend>' . $legend . "</legend>");
  }

Nothing gets done at all with the additional params?  

I altered this function as follows to actually use the additionalParams 
argument.  

  public function openFieldset($legend, $additionalParams="") {

    $params["class"] = "pfbc-fieldset";

    if(!empty($additionalParams["class"])) {
      $params["class"] .= " {$additionalParams["class"]}";
    }

    if(!empty($additionalParams) && is_array($additionalParams)) {
      foreach($additionalParams as $key => $value)
        $params[$key] = $value;
    }

    $fieldset_markup = '<fieldset';
    foreach ($params as $key => $value) {
      $fieldset_markup .= ' ' . $key . '="' . $value . '"';
    }
    $fieldset_markup .= '><legend>' . $legend . "</legend>";

    $this->addElement("", "", "htmlexternal", $fieldset_markup);

  }

Original issue reported on code.google.com by rj05cole...@gmail.com on 9 Nov 2010 at 8:53

GoogleCodeExporter commented 8 years ago
Thanks for the feedback and patch.  The latest revision - r430 - includes 
changes to the openFieldset function to apply the additionalParams parameter to 
the <fieldset> tag.

- Andrew

Original comment by ajporterfield@gmail.com on 10 Nov 2010 at 3:45