Create and Validate PHP Forms in Seconds.
Misc. bug fixes.
Finally! Error messages will now appear under each form element if $form->inline_errors
is set to TRUE
.
Added a cURL option for use with reCAPTCHA.
Fixed an issue with date
and datetime
validation.
Formr now defaults to Bootstrap 5 when instantiating Formr with the 'Bootstrap' parameter.
$form = new \Formr\Formr('bootstrap'); // defaults to Bootstrap 5
Formr no longer uses FILTER_SANITIZE_STRING
in the sanitize_string
validation rule as it's been depreciated in PHP 8. The rule now uses strip_tags()
.
Added a nowrap
switch to remove bootstrap and bulma element <div>
wrappers.
$form = new \Formr\Formr('bootstrap', 'nowrap');
Added a honeypot
method for inserting a honeypot into the form.
$form->honeypot('company_name');
Fixed an issue where Formr would not add the default Bootstrap or Bulma element class (e.g.; form-control
) when adding custom classes to an element.
Fixed an issue where inline help text was not properly displayed when using Bootstrap 5.
Removed (int)
casting from some validation methods as it was preventing the use of floats.
Fixed an issue where 0 (zero) would not work in the greater_than_or_equal
validation rule.
Added ability to change messages()
error message heading text
$form->error_heading_plural = 'Please Correct the Following Errors';
$form->error_heading_singular = 'Please Correct the Following Error';
Updated redirect()
method and added a default value for redirecting to the same page, plus added exit
after the redirect.
Fixed an issue where flash messages would not print properly in hush mode.
Added Fieldsets to FastForm
$data = [
'fieldset1' => [
'legend' => 'Name & Email',
'fields' => [
'text1' => 'name,Name',
'email' => 'email,Email',
],
],
'fieldset2' => [
'legend' => 'Address',
'fields' => [
'text2' => 'address,Address',
'text3' => 'city,City',
'select' => 'state,State,,,,,,states',
'number' => 'zip,Zip',
],
],
'textarea' => 'comments,Comments'
];
$form->fastform($data);
Added $form->recaptcha_action_name
to the reCAPTCHA JavaScript so you can differentiate forms via actions in the reCAPTCHA Admin panel.
Added a new clear()
method to empty the $_POST
super global after a form submission.
if($form->submitted())
{
$name = $form->post('name');
$email = $form->post('email');
if($form->ok()) {
$form->clear();
}
}
Fixed an issue with FastForm arrays not handling hidden elements properly (based off of 81c4dc7e07f2727073c871891a8b1e934714a446)
Removed <fieldset>
from FastForm
Cleaned up some code
Added support for Google reCAPTCHA v3. ReCheck out the blog post for more info.
It's easier than ever to work with multiple forms on one page. You no longer have to add hidden fields and check if they were submitted, Formr will now do this automatically. Check out the blog post to see how.
You can now add your validation rules as an array!
if($form->submitted()) {
$name = $form->post('name', '', ['min[3]', 'max[60]', 'not_regex[/foo|bar/]']);
}
Added a required
validation rule (how did I overlook this?!).
Fixed an issue with labels not working properly in FastForm.
Bug fixes
Bug fixes