TOPIC:

Dynamic Variables 1 month 1 day ago #253199

  • Topic Author
  • mrperfectpz
  • Offline
  • Gold Breezer
  • Gold Breezer
  • Posts: 395
  • Thanks: 0
Hi

How would I create dynamic variables within a loop so I can use these to store multiple data.

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

Dynamic Variables 1 month 7 hours ago #253207

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

where exactly you want to use it, could you explain it a little better ? :)

Regards,
Tihana

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

Dynamic Variables 1 month 6 hours ago #253213

  • Topic Author
  • mrperfectpz
  • Offline
  • Gold Breezer
  • Gold Breezer
  • Posts: 395
  • Thanks: 0
I have a checkbox group which is created automatically so the number of checkboxes changes. I would like to create a loop to thw number of checkboxes and then inside the loop create variables so I can save inside each variable to use later. Each time the individual checkbox is checked I want it to +1 and store. I hope this explains a little better

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

Dynamic Variables 1 month 6 hours ago #253215

  • tihana.krivic's Avatar
  • tihana.krivic
  • Offline
  • Moderator
  • Moderator
  • Posts: 3734
  • Karma: 3
  • Thanks: 302
Hi,
function ff_nameofcheckbox_action(element, action)
{
    switch (action) {
        case 'change':
vals = '';
          opts = JQuery("[name=\"ff_nm_nameofcheckbox[]\"]");
          for (o = 0; o < opts.length; o++)
          if (opts[o].checked)
          {
               vals = opts[o].value;
          }
          
          if (vals=="value1") // value1 is value of checkboxgroup
          {
               ff_getElementByName('total').value=Number(ff_getElementByName('total').value)+1;
          }
         else if(vals=='value2') //value2 is value of checkboxgroup
{
 ff_getElementByName('total').value=Number(ff_getElementByName('total').value)+1;
}
else if(vals=='value3') // value3 is value of checkboxgroup
 {
 ff_getElementByName('total').value=Number(ff_getElementByName('total').value)+1;
}

          
            break;
        default:;
    } // switch
} // ff_nameofcheckbox_action
NOTE: total is name of textfield in which is added +1 if checkbox is checked (replace it with your name)

In this code you can use variables.
e.g vals is variable which takes values of checkboxgroup.

Hope this helps

Regards,
Tihana

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

Dynamic Variables 4 weeks 2 days ago #253238

  • Topic Author
  • mrperfectpz
  • Offline
  • Gold Breezer
  • Gold Breezer
  • Posts: 395
  • Thanks: 0
As there are multiple checkbox values allowed I will be placing the +1 in a TEXTAREA so would this still work and if so how do I add new line after each

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

Dynamic Variables 4 weeks 2 days ago #253239

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

you want to show it like this in texteara:
1
1
1
not sum of this->e.g: 3 ?

Regards,
Tihana

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

Time to create page: 0.049 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!