joshcanhelp / php-form-builder

A simple, lightweight PHP class that makes creating forms easy
MIT License
130 stars 64 forks source link

Fieldset/legends #14

Open mapsedge opened 4 years ago

mapsedge commented 4 years ago

Added a field attribute, "group", and used vanilla javascript to wrap fieldsets around each set of controls with that group. The javascript is namespaced with a long, random string to avoid collisions. phpFormBuilder-withFieldsets.php.txt

Jowcey commented 2 years ago

I fixed a few issues in your insertJavascript function:

` function insertJavascript(){ $f = $this->form[id]; $objectName = $this->generateRandomString(20); $out = <<<EOT

            EOT;

    return $out;
}

`

Here i removed the getForm function and put it in it's used line. I then also added it the the getGroups function instead of grabbing the route document.

The issue with getting groups from the route document is that if you have multiple forms on your page it would always put the fieldsets from every form in the first form it finds