TOPIC:

Why is my email field requiring validation? 3 weeks 3 days ago #245188

  • Topic Author
  • dpetersen
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 15
  • Thanks: 1
I have an email field that is NOT required. If a user enters info in that field I want it to be valid so I entered an error message and a validation script. Now, however, the field is forcing the user to enter info in the field so it is acting like a required field. Is that how it is supposed to act? Can I validate info only if they enter something but not force them to enter info?

Please Log in or Create an account to join the conversation.

Why is my email field requiring validation? 3 weeks 3 days ago #245189

  • tihana.krivic's Avatar
  • tihana.krivic
  • Offline
  • Moderator
  • Moderator
  • Posts: 644
  • Karma: 3
  • Thanks: 75
Hi,

this is because validation script for email forces the field not to be empty.
Go to your email element->Properties->Validation->check custom->Create code framework and put this:
function ff_NAMEOFELEMENT_validation(element, message)
{
  if (element.value != '') {
        var check =
                /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
        if (!check.test(element.value)) {
            if (message == '')
                message = element.name + " is no valid email address.\n";
            ff_validationFocus(element.name);
            return message;
        } // if
    }
    return '';
}
Please replace NAMEOFELEMENT with name of your element for email (not title).

Let me know if it is ok for you now.

Regards,
Tihana
The following user(s) said Thank You: dpetersen

Please Log in or Create an account to join the conversation.

Why is my email field requiring validation? 3 weeks 3 days ago #245190

  • Topic Author
  • dpetersen
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 15
  • Thanks: 1
That worked. Thanks!!

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Moderators: ForumSupport
Time to create page: 0.043 seconds

BreezingForms Pro 1.4.7 for WordPress Released!

Available in the membership section.

Summer Sale!

Massive discounts on all subscriptions!

Get Your Subscription Here

Quick Links

Downloads

BreezingForms

ContentBuilder

BreezingCommerce

Templates

Documentation

BreezingForms

ContentBuilder

BreezingCommerce

Apprendre BreezingForms (French Community)

Apprendre et maîtriser BreezingForms par des tutoriels et exemples, le tout en français

breezingforms.eddy-vh.com

Questions et réponses sur les forums de l'AFUJ

AFUJ

Special Offer

Summer Sale! All subscriptions at a special price!

Includes prio support, all of our current and future Joomla!® extensions and Joomla!® templates for the duration of your membership.

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!