TOPIC:

How can Breezing Forms Validation functions be used custom multi valadation? 3 weeks 3 days ago #245209

  • Topic Author
  • cheddarnines
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 36
  • Thanks: 0
I am trying to validate a large number of similar select drop downs by looping through them with jQuery().each.

What I would like to do is use Breezing Forms "Error message :" from the "Element Properties Validation" and get the errors to show up as per the normal behavior if I was to use a Library or a custom validation via Create code framework.

I have this while loop working to the degree that I can trigger an alert message for for each unique select dropdown element that is set to a value of "NONE".

This currently is done with code similar to this:
function validateOptionedOrders(orderName, numberOfOrders){
    var currentOrder = 1;
    var stopOrder = numberOfOrders;
    var orderSelectDropDown; // THIS IS A 
    var chosenValue;
        while(numberOfOrders >= currentOrder){
                if (chosenValue == "NONE") {
                    console.log("the if value was true at 'NONE'");
                    alert("#"+orderName+currentOrder+" select faild in my test")
                    // HOW DO I USE BF VALDATION HERE to Throw Error Messages from the "Element Properties Validation"
                    } // if              
        currentOrder++;
        console.log("currentOrder being incremented to "+currentOrder);    
    }
}

As needed I can pass that function names that "ff_getElementByName()" uses or IDs that jQuery could use for the individual errors and their respective select elements any way you suggest that would get the rest of this working.
I am already doing that with the function that calls the one above like this:
function multiValidator(){
    jQuery("input.hasOptions").each(function() {
        var name = jQuery(this).attr("name");
        console.log("this number input's name is "+ name);
        var ffname = name.replace('ff_nm_','').replace('[]','');
        console.log("this ff name is "+ ffname);
        var orderName = name.replace('ff_nm_','').replace('Qty[]','')+"Order";
        console.log("this items OrderName is "+ orderName);
        var numberOfOrders = ff_getElementByName(ffname).value;
        
        console.log("the number of " + orderName +" currently ordered is "+numberOfOrders);
            if(numberOfOrders>=1){
               validateOptionedOrders(orderName, numberOfOrders);
               }
    });     
}

The bit I am confused on here is that I don't really get what objects or listeners the Breezing Forms validation functions are using for (element, action) nor how the ff_validationFocus(element.name) function is handling the messages.

Thanks again for all your help!
Cheers - Dan S.

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

How can Breezing Forms Validation functions be used custom multi valadation? 3 weeks 3 days ago #245212

  • TheMuffinMan's Avatar
  • TheMuffinMan
  • Offline
  • Developer
  • Developer
  • Posts: 9796
  • Karma: 167
  • Thanks: 785
Hi,

please check Manage Scripts => ff_validate_submit and see how it is implemented.

You would basically need this part:
if(typeof bfUseErrorAlerts != 'undefined'){
     JQuery(".bfErrorMessage").html('');
     JQuery(".bfErrorMessage").css("display","none");
    }
    error = ff_validation(0);
    if (error != '') {

        if(typeof bfUseErrorAlerts == 'undefined'){
           alert(error);
        } else {
           bfShowErrors(error);
        }
        ff_validationFocus();
    }

"error" is simply a list of messages, separated by linebreaks.

I would recommend to store such things in the scripts manager, as well if your custom codes are getting more and more complex.

Regards,
Markus

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

Last edit: Post by TheMuffinMan.
  • Page:
  • 1
Moderators: ForumSupport
Time to create page: 0.044 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!