formr

Create and Validate PHP Forms in Seconds.

GPL-2.0 License

Downloads
18.2K
Stars
360
Committers
10

Bot releases are hidden (Show)

formr - 1.5.2

Published by timgavin 2 months ago

  • Fixed an issue when adding custom CSS classes to select menus
  • Fixed an issue with Bootstrap inline checkboxes

Full Changelog: https://github.com/formr/formr/compare/1.5.1...1.5.2

formr - 1.5.1

Published by timgavin 4 months ago

What's Changed

New Contributors

Full Changelog: https://github.com/formr/formr/compare/1.5.0...1.5.1

formr - 1.5.0 Latest Release

Published by timgavin 8 months ago

Potentially Breaking Changes

  • Dropped support for PHP 7.x.
  • Submitting HTML in form fields is now disabled by default.
  • Wrappers have been rewritten. Everything should be okay, but check your layouts before using in production just in case!

What's Changed

  • PHP minimum version is now 8.1.
  • Formr no longer allows HTML in form fields as a default behavior.
  • Removed several older PHP string and mcrypt functions, and replaced them with modern PHP 8 functions.
  • Added a check to make sure a directory exists before uploading files.
  • Added better support for checking if custom classes are being used.
  • Removed the Reflection method when checking for custom wrapper classes.
  • Rewrote the wrapper instantiation.
  • Cleaned up the wrapper classes.
  • Cleaned up a bunch of junk and removed a few unused methods.

Added a wrapper for Tailwind CSS

  • Formr now has a Tailwind wrapper.
  • You must require the @tailwindcss/forms plugin in your tailwind.config.js file for the wrapper to work properly.
  • You can find the Tailwind classes inside the Tailwind wrapper trait located at lib/wrappers/tailwind.php.

Note

  • I did not add return types or type hints because the code was written under PHP 5, so adding them would basically kill your app because I did a lousy job of creating the methods and properties back in the day.

  • The Bootstrap 3 and 4 wrappers have not been updated as they are obsolete.

formr - 1.4.11

Published by timgavin 8 months ago

  • Resolves an issue with $_SESSION and checkbox/dropdown arrays
  • Updated a Bootstrap wrapper class name
formr - 1.4.10

Published by timgavin over 1 year ago

  • Fixed an infinite loop issue when using custom wrappers
formr - 1.4.9

Published by timgavin over 1 year ago

  • Fixed an issue where validation rules would run if the field was empty and not required
  • Fixed an issue with the required indicator (*) in the Bootstrap wrapper
formr - 1.4.8

Published by timgavin over 1 year ago

  • Fixed an issue with Fastform not creating a multiple select list
  • Fixed an issue with a default select_multiple() item being selected when empty
  • Fixed an issue with $_SESSION
formr - 1.4.7

Published by timgavin over 1 year ago

  • Updated for PHP 8.2
  • Removed CSRF token from $form->send_email()
  • Added Former version and PHP version to $form->info()
formr - 1.4.6

Published by timgavin almost 2 years ago

  • Added a value attribute to the honeypot method.
  • Bug fixes
formr - 1.4.5

Published by timgavin over 2 years ago

Added an error() function to print out inline error messages

$form->text('first_name', 'First name');
$form->error('first_name');

Fixed an issue where hidden elements would not have an ID.

Fixed an issue where changing the name of uploaded files would truncate the filename.

formr - 1.4.4

Published by timgavin over 2 years ago

You can now add custom headers to your HTML emails when using send_email()

$headers  = "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$headers .= "From: " . $from . "\r\n";

$form->send_email($to, $subject, $message, $from, 'HTML', $headers);

You can now set a timeout duration for CSRF in FastForm.

// Set the CSRF timeout to 1800 seconds
$form->fastform($data, 1800);
  • Fixed an issue with CSRF checks where multiple error messages would show if the SESSION expired.
  • CSRF timeout error messages will now be styled in your wrapper's error alert format.
formr - 1.4.3

Published by timgavin over 2 years ago

Bug fixes

formr - 1.4.2

Published by timgavin over 2 years ago

Misc. bug fixes.

formr - 1.4.1

Published by timgavin over 2 years ago

  • 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 - 1.4

Published by timgavin almost 3 years ago

Formr 1.4

Possible Breaking Changes

Formr now defaults to Bootstrap 5 when instantiating Formr with the 'Bootstrap' parameter.

$form = new \Formr\Formr('bootstrap'); // defaults to Bootstrap 5

Validation

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

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

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.

formr - 1.3.7

Published by timgavin about 3 years ago

New

Implemented basic support for Bootstrap 5

$form = new \Formr\Formr('bootstrap5');

Fixed

Made open elements self-closing, e.g.; />.
Fixed an issue with Bulma checkboxes not appearing inline.

formr - 1.3.6

Published by timgavin about 3 years ago

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.

formr - 1.3.5

Published by timgavin about 3 years ago

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);
formr - 1.3.4

Published by timgavin over 3 years ago

Formr 1.3.4

New Parameter

Added $form->recaptcha_action_name to the reCAPTCHA JavaScript so you can differentiate forms via actions in the reCAPTCHA Admin panel.

New Method

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

formr - 1.3.3

Published by timgavin over 3 years ago

Formr 1.3.3

reCAPTCHA v3

Added support for Google reCAPTCHA v3. ReCheck out the blog post for more info.

Multiple Forms

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.

Validation Arrays

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/]']);
}

New Validation Rule

Added a required validation rule (how did I overlook this?!).

Fixed

Fixed an issue with labels not working properly in FastForm.