impress-org / givewp-snippet-library

A collection of code snippets to enhance or expand on the free Give WordPress Donation Plugin.
https://givewp.com
140 stars 90 forks source link

fix: ensure require last name field snippet error_message gets precedence over browser message #95

Closed samsmith89 closed 5 years ago

samsmith89 commented 5 years ago

Bug Report

User Story

As a site admin, I want to control the output of the error message in the custom snippet provided so that my error message takes precedence.

Current Behavior

Currently the default browser message of "Please fill out this field." is displayed over the snippet 'error_message' that is passed.

Expected Behavior

I expect the error message that I provide to display when the field is left empty.

Bug Type

Steps to Reproduce

  1. add the snippet here: https://github.com/impress-org/give-snippet-library/blob/master/form-customizations/require-last-name.php
  2. Leave the last name field empty
  3. See that "Please fill out this field." show over the error_message in the snippet.

Visuals

screen shot 2019-01-17 at 10 35 58 am

Possible Solution

Utilize the "validationMessage" to change the error message for browser field errors: https://lecklider.com/2015/08/customizing-native-form-validation.html

Related

https://secure.helpscout.net/conversation/755277271/32694/

Acceptance Criteria

Environment

Operating System
  • Platform: Mac OS X
Browser
  • Name: Chrome
WordPress System Info ### WordPress Environment ### Home URL: http://give.local Site URL: http://give.local WP Version: 4.9.9 WP Multisite: – WP Memory Limit: 256 MB WP Debug Mode: – WP Cron: ✔ Language: en_US Permalink Structure: /%postname%/ Show on Front: posts Table Prefix Length: wp_ Table Prefix Length: 3 Table Prefix Status: Acceptable Admin AJAX: Accessible Registered Post Statuses: publish, future, draft, pending, private, trash, auto-draft, inherit, request-pending, request-confirmed, request-failed, request-completed, acf-disabled, refunded, failed, revoked, cancelled, abandoned, processing, preapproval, give_subscription ### Server Environment ### Hosting Provider: DBH: localhost, SRV: give.local TLS Connection: Connection uses TLS 1.2 TLS Connection: Probably Okay Server Info: Apache/2.4.10 (Debian) PHP Version: 7.1.4 PHP Post Max Size: 1,000 MB PHP Time Limit: 900 PHP Max Input Vars: 3000 PHP Max Upload Size: 1,000 MB cURL Version: ❌ 7.38.0, OpenSSL/1.0.1t - We recommend a minimum cURL version of 7.40. SUHOSIN Installed: – MySQL Version: 5.6.34 Default Timezone is UTC: ✔ fsockopen/cURL: ✔ SoapClient: ✔ DOMDocument: ✔ gzip: ✔ GD Graphics Library: ✔ Multibyte String: ✔ Remote Post: ✔ Remote Get: ✔ ### Give Configuration ### Give Version: 2.3.1 Give Cache: Enabled Database Updates: All DB Updates Completed. Give Cache: Enabled Give Cache: ✔New Donation✔Donation Receipt❌New Offline Donation❌Offline Donation Instructions✔New User Registration✔User Registration Information✔Donor Note✔Email access✔Renewal Receipt Email✔Subscription Cancelled Email❌Subscription Completed Email✔Subscription Reminder Email✔Subscriptions Email Access Upgraded From: 2.3.0 Test Mode: Enabled Currency Code: USD Currency Position: Before Decimal Separator: . Thousands Separator: , Success Page: http://give.local/donation-confirmation/ Failure Page: http://give.local/donation-failed/ Donation History Page: http://give.local/donation-history/ Give Forms Slug: /donations/ Enabled Payment Gateways: Test Donation, Authorize.net, Stripe - Credit Card Default Payment Gateway: Test Donation PayPal IPN Verification: Disabled PayPal IPN Notifications: N/A Donor Email Access: Enabled ### Active Give Add-ons ### Give - Annual Receipts: ❌ Unlicensed – by GiveWP – 1.0.0 Give - Authorize.net Gateway: ❌ Unlicensed – by GiveWP – 1.4.4 Give - Braintree Gateway: ❌ Unlicensed – by GiveWP – 1.2.3 Give - CCAvenue Gateway: ❌ Unlicensed – by GiveWP – 1.0.4 Give - Donation Upsells for WooCommerce: ❌ Unlicensed – by GiveWP – 1.1.0 Give - Fee Recovery: ❌ Unlicensed – by GiveWP – 1.7.4 Give - Form Countdown: ❌ Unlicensed – by WordImpress – 1.0.1 Give - Form Field Manager: ❌ Unlicensed – by GiveWP – 1.4.1 Give - Google Analytics Donation Tracking: ❌ Unlicensed – by GiveWP – 1.2.1 Give - MailChimp: ❌ Unlicensed – by GiveWP – 1.4.3 Give - Manual Donations: ❌ Unlicensed – by GiveWP – 1.4.2 Give - PayPal Pro Gateway: ❌ Unlicensed – by GiveWP – 1.2.1 Give - Paytm Gateway: ✔ Licensed – by WordImpress – 1.0.1 Give - PDF Receipts: ❌ Unlicensed – by GiveWP – 2.3.2 Give - Recurring Donations: ❌ Unlicensed – by GiveWP – 1.8.2 Give - Stripe Gateway: ❌ Unlicensed – by GiveWP – 2.1.2 Give - Tributes: ❌ Unlicensed – by GiveWP – 1.5.2 Sam's Helper Function: ❌ Unlicensed – by WordImpress – 1.0 ### Other Active Plugins ### Advanced Custom Fields: by Elliot Condon – 5.7.7 Give - Hook Helper: by Ravinder Kumar – 1.0 Notification: by BracketSpace – 5.3.2 Transients Manager: by Pippin Williamson – 1.7.5 User Role Editor: by Vladimir Garagulya – 4.47 WP Business Reviews: by Impress.org – 1.2.0 ### Inactive Plugins ### All-in-One WP Migration: by ServMask – 6.78 Contact Form 7: by Takayuki Miyoshi – 5.0.4 Elementor: by Elementor.com – 2.3.2 Give - Email Reports: by WordImpress – 1.1.2 Give - Gift Aid: by WordImpress – 1.1.6 Give - GoCardless Gateway: by WordImpress – 1.2.1 Give - Mollie Gateway: by WordImpress – 1.1.2 Give - Razorpay: by WordImpress – 1.2.0 Gutenberg: by Gutenberg Team – 4.1.1 Intelligence: by LevelTen – 1.3.1 Invisible reCaptcha: by Mihai Chelaru – 1.2.1 WooCommerce: by Automattic – 3.5.2 WordPress Importer: by wordpressdotorg – 0.6.4 ### Active MU Plugins ### Bypass Login: by Stephen Carnam – 1.1.0 ### Theme ### Name: Twenty Seventeen Version: 1.7 Author URL: https://wordpress.org/ Child Theme: No – If you're modifying Give on a parent theme you didn't build personally, then we recommend using a child theme. See: How to Create a Child Theme
kevinwhoffman commented 5 years ago

@samsmith89 We discussed and are going to close as wontfix. Trying to customize that validation message in the browser errors is different in each browser and we've moved away from it since writing that snippet. Form API will bring consistency and customization to these messages in the future.