• Resolved siddheshsj

    (@siddheshsj)


    Hi again Chris,

    Your plugin is working absolutely superb!! I have managed to integrate mailchimp plugin.
    Is it possible to validate fields using custom code?? Any hook that i can use??
    OR i have to manually select field’s id and validate??
    Main reason for this is that plugin’s form is accepting white spaces as a input, so even though fields are set to be required , it is considering the white space as input

    Any help much appreciated! Thanks in advance

    Siddhesh

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor Chris Dillon

    (@cdillon27)

    Thanks for catching this. I will publish an update later today which will trim spaces when validating the fields.

    Thread Starter siddheshsj

    (@siddheshsj)

    Thanks for the update.
    1 more issue i found out w.r.t. email validation
    It is accepting test@testcom , if you notice i dint add .com. So i guess if you are using pattern for validation than regular expression must have .(dot) domain

    Plugin Contributor Chris Dillon

    (@cdillon27)

    The plugin uses this popular jQuery form validation plugin.
    https://jqueryvalidation.org/email-method/

    That uses the regex in this WHATWG spec.
    https://html.spec.whatwg.org/multipage/input.html#valid-e-mail-address

    I believe the reason that spec does not require a (dot) is for valid addresses like “root@localhost” but obviously that is unwanted in our use case.

    Ask 100 programmers for an email regex and you will get 100 different answers.
    https://stackoverflow.com/questions/46155/how-to-validate-email-address-in-javascript

    A missing (dot) is important but it’s just a typographical error and no different than someone misspelling their name or domain. The burden is on the user to enter it correctly.

    The only way to verify an email address is to send a confirmation email like WordPress does for new users.

    Are you concerned about preventing typing errors or preventing fake emails?

    Thread Starter siddheshsj

    (@siddheshsj)

    Way i see it , both reasons(typing error & fake mail) are considered as invalid email id won’t be of help if i want to send mail or just keep record in db

    Plugin Contributor Chris Dillon

    (@cdillon27)

    There is no bulletproof solution. I’m hesitant to start a Quest for the Perfect Regex which will only provide incremental benefits. Even with a confirmation email, the burden is still on the user.

    I will add an option to send a confirmation email to the feature request list.

    The existing validation will have to suffice.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Hook for validating existing fields’ is closed to new replies.