Zebra_Form
Zebra_Form copied to clipboard
Zebra_Form CSS class not added to the form
When running the example, the form is not styled, JavaScript validation does not work.
I think the culprit is in the initialization of the Zebra_Form
class where $attributes
are (by default) initialized to an empty string instead of an empty array. Consequent adding of the Zebra_Form
CSS class (in render()
) thus does not modify the array as intended.
I think this is related to upgrade to PHP 7 as I have not seen this behaviour several month ago.
Anyway, for me the following patch worked:
--- a/Zebra_Form.php
+++ b/Zebra_Form.php
@@ -163,7 +163,7 @@ class Zebra_Form
*
* @return void
*/
- function __construct($name, $method = 'POST', $action = '', $attributes = '')
+ function __construct($name, $method = 'POST', $action = '', $attributes = [])
{
$this->controls = $this->variables = $this->errors = $this->master_labels = array();