TOPIC:

one element value based on inputted value of another element 2 weeks 4 days ago #253885

  • Topic Author
  • allantschultz
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 38
  • Thanks: 0
I am trying to build a quote form where the price element varies based on volume (the entered quantity).

I do not know how to obain the right price (37price) for the entered quantity(37quantity) so it will calculate the correct extended price (37extprice).

Example;
37price is $1000.00 if 37quantity <5
37price is $900.00 if37 quantity <10
37price is $850.00 if 37quantity <50
37price is $800.00 if 37quantity <150
37price is $750.00 if 37quantity >149

I am using the following Actionscripts -

function ff_37quantity_action(element, action)
{
ff_getElementByName('37extprice').value =
Number(ff_getElementByName('37price').value) *
Number(ff_getElementByName('37quantity').value);
}
// ff_37quantity_action<br><br>



function ff_37price_action(element, action)
{
ff_getElementByName('37extprice').value =
Number(ff_getElementByName('37price').value) *
Number(ff_getElementByName('37quantity').value);
}
// ff_37price_action<br><br>


function ff_37extprice_action(element,action)
{
ff_getElementByName('37extprice').value = 0;
{
ff_getElementByName('37extprice').value =
Number(ff_getElementByName('37price').value) *
Number(ff_getElementByName('37quantity').value);
}
}
// ff_37extprice_action

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

one element value based on inputted value of another element 2 weeks 4 days ago #253892

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

which elements are you using for this? Textfields or ?
Could you explain it a little better, that I can make an example form and send it to you?

Regards,
Tihana

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

one element value based on inputted value of another element 2 weeks 4 days ago #253938

  • Topic Author
  • allantschultz
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 38
  • Thanks: 0
I am attaching a jpg to try to explain what I am trying to accomplish with the form which I have also sent as a zip file. Thank you so much for any assistance you may provide.
Attachments:

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

one element value based on inputted value of another element 2 weeks 4 days ago #253947

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

please set actionscripts of elements to None.
Then go to your form->Advanced->More options->Scripts->Initialization script->check Custom and put this:
function ff_nameofyourform_init()
{
setInterval('calc()',500);
} // ff_nameofyourform_init

function calc() {
if(ff_getElementByName('36quantity').value > 0 && ff_getElementByName('36quantity').value <=5) {
ff_getElementByName('36price').value=1000;
}
else if(ff_getElementByName('36quantity').value > 5 && ff_getElementByName('36quantity').value <= 25) {
ff_getElementByName('36price').value=950;
}
else if(ff_getElementByName('36quantity').value > 25 && ff_getElementByName('36quantity').value <= 75) {
ff_getElementByName('36price').value=875;
}
else if(ff_getElementByName('36quantity').value > 75 && ff_getElementByName('36quantity').value <= 150) {
ff_getElementByName('36price').value=800;
}
else if(ff_getElementByName('36quantity').value > 150) {
ff_getElementByName('36price').value=800;
}
ff_getElementByName('36extprice').value =
Number(ff_getElementByName('36price').value) *
Number(ff_getElementByName('36quantity').value);
}
Please replace nameofyourform with name for your form (not title)

Let me know if you need more help

Regards,
Tihana

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

one element value based on inputted value of another element 2 weeks 3 days ago #253955

  • Topic Author
  • allantschultz
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 38
  • Thanks: 0
Tihana,

Thank you, it works fine the first of the line items (sections). I will have 85-100 of these line items when finished.

How do I add additional "if,else if" statements for the additional line items (sections)?

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

one element value based on inputted value of another element 2 weeks 3 days ago #253960

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

on the same way as for first sections, in form->Advanced->More options->Scripts->Init. script.

Please test it, if you have problems I will assist :)

Regards,
Tihana

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

Time to create page: 0.050 seconds

BreezingForms Pro 1.4.7 for WordPress Released!

Available in the membership section.

September Discount!

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!