Closed (fixed)
Project:
Advanced Email Validation
Version:
1.0.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
7 Feb 2022 at 04:21 UTC
Updated:
26 Apr 2022 at 02:04 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
darvanenComment #3
alphex commentedvoting for this...
I'd love to be able to easily list domains that can be refused in an email field on webform.
Comment #4
darvanen@alphex a question: should it be configurable per-handler or would using the site-wide configuration be enough for your use-case?
Asking because I'm not sure how to support translations inside the webform handler.
Comment #5
alphex commentedI think ideally, it would be a setting for each form - as I can see some forms needing to be locked down by domain validation on a required email field...
where other forms, on the same site would allow any email to be validated in a required email field.
Comment #7
kristen polWhoops. Didn't mean to click that... browser was being sluggish. Sorry for the noise :)
Comment #9
joshua1234511Added some basic functionality to get started with
Implemented
- Added the advanced_email_webform_validator_handler
- Implemented the configuration form
-- Includes Configurable "Select the email field/s to be validated" Predefined email field values obtained from the form it self.
-- Handler can be added only if email field exits in the form
-- Handler can be configured for webform, ignoring the global.
Pending
-- add the hook validator handler to validate on form submit
-- Pass global settings as default
Comment #10
darvanenAmazing work, thank you! I love how much thought is going into this.
I had orignially envisaged the handler not even having form inputs for the validator settings if it was using the site defaults but passing the defaults through to the form elemetns could work too. Comes with pros and cons:
Pro: Webform settings won't be altered by changes to the site settings
Con: Webform settings won't be updated with changes to the site settings ;)
I can see use-cases for both.
Perhaps we could have a best-of-both-worlds approach? A checkbox to "override site defaults" which then displays the settings fields? That way if it is not checked, you just don't pass any config to the service when you run validate and it will use the auto-loaded site defaults.
Thoughts?
Comment #11
kristen polNice work... changing to needs work for the remaining items in #9 and the feedback in #10.
Comment #12
joshua1234511Updated branch with


-- Pass global settings as default
Request from #10
Override setting added to use global values if no changes.
Commit: https://git.drupalcode.org/issue/advanced_email_validation-3262799/-/com...
Pending
-- add the hook validator handler to validate on form submit
Comment #14
joshua1234511Implemented the hook validator handler to validate on form submit

Webform handler can be configure for each email field separately or collectively.
Settings can be global or individual.
Comment #15
kristen polRemoving tag.
Reviewed for formatting and comments/text and found some minor things.
Someone else should review to see if the code covers what is wanted.
Comment #16
darvanenThis is fantastic! Thank you for the work that went into it so far.
I've tested out the validator and it works brilliantly with the default settings (again, thank you), but it seems the option to override has an issue. The values get saved into the handler and it seems the checkbox to turn on a rule is working, but not the error message override.
Here's the settings I put the on the handler:
And here's the result:
Otherwise this is looking pretty complete, I'll make sure to credit you on the project page when this is committed as it's a big piece of functionality.
Comment #17
joshua1234511Fixed issues reported in #16
Comment #18
darvanenLooks great @joshua1234511, just one more comment on the code then I reckon we're good to go. I've tagged this for automated test but I won't hold back committing the feature waiting on those, they can be a follow-up if they're not done by the time the feature is ready.
Comment #20
darvanenI'll make a follow-up for tests. Thanks everyone, I think this is going to be a really useful thing :)
Comment #21
darvanenIf anyone landing here would like to have a go at writing tests for this feature, please see #3274693: Write tests for webform validation handler