Dependencies

  • WebWizardWorkshop
  • Topic Author
  • Offline
  • Senior Boarder
  • Senior Boarder
  • Posts: 49
  • Thank you received: 0

WebWizardWorkshop created the topic: Dependencies

I need to set up dependencies and, while I've done that with other modules, I'd like to use breezing form for this project because it is subject to grow and could turn into a full ecommerce site at some point and since you guys have the best ecommerce kit I want to stick with you guys on this project. However, I can't find anything on creating dependencies for a dropdown list that is not using a database table for its options. If a user goes to this site and selects a specific hair type, depending on which type they choose which dropdown list will appear with the appropriate length and price options. Do you guys have any sample scripts I can use with instructions on where those script pieces go?
#232847
  • Posts: 2365
  • Karma: 85
  • Thank you received: 317

mihaela replied the topic: Dependencies

Hello,



First way that you could do this would be to predefine more dropdown lists with the appropriate length and price options and turn them off.
Then depending on what is selected in the list the other elements would be shown or hidden. That you can achieve with visibility rules as explained here crosstec.org/en/support/online-documenta...f-conditionally.html .

In this case, you could also fill all the select lists which will then show/hide with values from database following this instructions crosstec.org/en/support/online-documenta...ct-list-from-db.html .

Another way to show a result depending on what is selected in select list directly fetching data form database in moment when some value is selected in first dropdown, which would require making ajax call, is as explaiend in this topic crosstec.org/en/forums/1-forums/125334-m...m-list.html?start=12 .

Here it is explained how you can fill in second select list with data from database depending on what is selected in the other element in the form.

Let me know whether this helped and whether you've managed to make it work for your form.

If you have more questions, feel free to ask.

Regards,

Mihaela
#232858
  • WebWizardWorkshop
  • Topic Author
  • Offline
  • Senior Boarder
  • Senior Boarder
  • Posts: 49
  • Thank you received: 0

WebWizardWorkshop replied the topic: Dependencies

"Now click on the "switcher" and in its options you'll find the "Group" box with default values, "

I'm following the instructions at ' crosstec.org/en/support/online-documenta...f-conditionally.html ' to create dependencies on a hair type dropdown list.

Another two dropdown lists (two different sets of length/price options) will be created as those dependencies, which appears will depend on the selection made in the hair type dropdown list. These options in these dropdown lists are not pulling from a database table, but are configured directly into the form.

Following the instructions of the above link I have clicked on the 1st length/price dropdown lists and and turned it off as instructed. Then it says "Now click on the "switcher" and in its options you'll find the "Group" box with default values..." Maybe I'm missing it but I see nothing on this form called 'switcher' to click on which means I see no 'group' box and there is no print screen showing it in the article. Where is it?
#232879
  • Posts: 2365
  • Karma: 85
  • Thank you received: 317

mihaela replied the topic: Dependencies

Hello,

Above in the article this is stated: "Add two fields, one textfield with the name "mytextfield" and a radiogroup with the name "switcher".".

Therefore, "switcher" in this context should be a radio group element that you have created.

Since you want form elements to show/hide depending on which option is selected in select list you should create a select list element named switcher to follow this example.
Then instead of finding "Group" box in the Properties you will see "List" box.
You can define the list values like this:
0;Turn on;on 
0;Turn off;off
Then follow further instructions from the article to add corresponding visibility rules.

Let me know whether you've managed to set this for your form.
If you have more questions, feel free to ask.

Regards,

Mihaela
#232896
  • WebWizardWorkshop
  • Topic Author
  • Offline
  • Senior Boarder
  • Senior Boarder
  • Posts: 49
  • Thank you received: 0

WebWizardWorkshop replied the topic: Dependencies

Okay, the visibility is good to go.

However, my calculations are not always coming out right. I simulated a customer changing their minds from one hair type to another after already selecting dependencies from their original choice in hair type. Than I proceed to make new selections from the new dependencies that show up due to that change. The price doesn't always reflect accordingly.

Hair type is a dropdown list with dependencies, there are two different length/price options dropdown lists dependencies that switch on/off based on the selections made in hair type. here are the formulas used in both the dependencies, the quantity, and the total.

The form is located at: dev.webwizardworkshop.com/index.php/place-an-order


Select Length (length)

function ff_length_action(element, action)
{
ff_getElementByName('total').value =
Number(ff_getElementByName('length').value) *
Number(ff_getElementByName('quantity').value);
}
// ff_length_action


Select Length (length2)

function ff_length2_action(element, action)
{
ff_getElementByName('total').value =
Number(ff_getElementByName('length2').value) *
Number(ff_getElementByName('quantity').value);
}
// ff_length2_action


Quantity (quantity)

function ff_quantity_action(element, action)
{
ff_getElementByName('total').value =
Number(ff_getElementByName('length').value) +
Number(ff_getElementByName('length2').value) *
Number(ff_getElementByName('quantity').value);
}

// ff_quantity_action



Total (total)

function ff_total_action(element,action)
{
ff_getElementByName('total').value = 0;
{
ff_getElementByName('total').value =
Number(ff_getElementByName('length').value) +
Number(ff_getElementByName('length2').value) *
Number(ff_getElementByName('quantity').value);
}
}
// ff_total_action



Paypal Amount

<? php return value=(bfField('total')); ?>
Business email entered
Token entered
Test email entered
Test token entered


As for the growing white space: it occurs where ever the form is whether that is a sidebar, modal, or page body content.
#232947
  • Posts: 2365
  • Karma: 85
  • Thank you received: 317

mihaela replied the topic: Dependencies

Hello again and Happy New Year,

Sorry for the late response, Crosstec Support staff was on collective holiday vacation, as noted in the forum.

Here are what you have to change to make this:

1) First change is make a change in "quantity" and "total" field's Actionscripts.
The code should look like this:
ff_getElementByName('total').value = (
Number(ff_getElementByName('length').value) +
Number(ff_getElementByName('length2').value) ) *
Number(ff_getElementByName('quantity').value);
Note that the brackets are added around the sum of the two lengths. This has to be made so that values are first added and then multiplied with quantity. Without the brackets, the multiplication will be made prior to addition as in mathematical functions natural order.

2) The second change you have to make is to add the following Actionsctipt code to the "hair type" element:
function ff_type_action(element, action)
{
    ff_getElementByName('length').value = "";
    ff_getElementByName('length2').value = "";
ff_getElementByName('total').value = 0;
} // ff_type_action
NOTE: To make this work, make sure that "type" is the Name of that select list in your form. Also, set Action to Change.
What this will do, is it will set both lengths select lists to "Select Length" options when hair type is changed. That way, when person changes their mind about the hair type, length previously selected(which might be hidden now) isn't added to the total.

Let me know whether after you do the explaiend changes to your form it works as you wanted.

Regards,

Mihaela
#233036
Moderators: ForumSupporttomeperica
Time to create page: 0.078 seconds

Live Support Chat Opened!

Join our Discord chat here to receive live support and talk directly to the team!

Summer Sale!

50% discount on all of our extension subscription plans & templates!

Get Your Subscription Here

News and Updates

Get informed about new downloads, updates and more in our News and Updates newsletter.

All Extensions Subscription

Get 1 year access to all of our current and future products and 1 year of professional support -- 99 for just 49! (Summer Sale)

No support per domain or website installation limits! Includes all of our current and future Joomla!® extensions, Joomla!® templates for the duration of your membership. This means, by purchasing an All Extensions Subscription you'll have it all covered!

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!

Live Support Chat Opened!

Join our Discord chat here to receive live support and talk directly to the team!

Community Reward

Help us to create new extensions and plugins! With only $5 you help us a lot and get unlimited download access to all of our products, professional support and even more. Get your reward now!

Read More Here