I'm trying to get a small Proof of Concept working with ValidFormBuilder. I created a form with just a text area. Very simple, but the HTML that ValidFormBuilder generates is not valid. There's javascript-code at strange places, it looks like rubbish and there's a lot of duplicate code in the generated HTML. Can anybody tell me what I'm doing wrong?
You can see the strange behavior over here: http://zorginformatiegroep.nl/form/test.php
This is my code:
<?php
require_once 'vendor/autoload.php';
use ValidFormBuilder\ValidForm;
$objForm = new ValidForm("hello", "Required fields are printed in bold.", "/test.php");
$objForm->addField(
"message",
"Your Message",
ValidForm::VFORM_TEXT,
array(
// Make this field required
"required" => true
),
array(
// Error message when required state isn't met
"required" => "This is a required field"
),
array(
"cols" => 20,
"rows" => 10
)
);
//*** Generate form output
if ($objForm->isValid() && $objForm->isSubmitted()) {
$strOutput = $objForm->valuesAsHtml();
} else {
$strOutput = $objForm->toHtml();
}
echo $strOutput
?>
The 3.2 release of ValidForm Builder was broken, you found that bug and I created the issue here:
https://github.com/neverwoods/validformbuilder/issues/14
I've bugged the problem and our team has released a new version: 3.2.1
If you've installed ValidForm Builder using Composer, depending on your configuration you should be fine by running composer update
.
This should answer your question.