TOPIC:

Checkbox group 2 months 4 weeks ago #254104

  • Topic Author
  • mrperfectpz
  • Offline
  • Gold Breezer
  • Gold Breezer
  • Posts: 411
  • Thanks: 0
I have a checkbox group and I would like to add the current checked value to a textfield no matter where it is in the group.
Currently it will only give the last in the loop

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

Checkbox group 2 months 4 weeks ago #254107

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

go to checkboxgroup->Advanced->Actionscript->check Custom:

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") // here you can add further dependencies
          {
               ff_getElementByName('nameoftextfield').value=jQuery('[name="ff_nm_nameofcheckbox[]"]:checked').val();
          }
         else if(vals=='value2') 
{
 ff_getElementByName('nameoftextfield').value=jQuery('[name="ff_nm_nameofcheckbox[]"]:checked').val();
}
else if(vals=='value3') {
 ff_getElementByName('nameoftextfield').value=jQuery('[name="ff_nm_nameofcheckbox[]"]:checked').val();
}
          
            break;
        default:;
    } // switch
} // ff_nameofcheckbox_action

Please replace:
-nameofcheckbox with name of your checkboxgroup (not title)
-value1,value2,value3 with value of your checkboxgroup
-nameoftextifeld with name of your textfield (not title)

Regards,
Tihana

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

Checkbox group 2 months 4 weeks ago #254108

  • Topic Author
  • mrperfectpz
  • Offline
  • Gold Breezer
  • Gold Breezer
  • Posts: 411
  • Thanks: 0
This doesnt seem to work for me as I am using multi check

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

Last edit: Post by mrperfectpz.

Checkbox group 2 months 4 weeks ago #254109

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

here is example:

File Attachment:

File Name: testmr.zip
File Size:7 KB


Have a nice weekend

Regards,
Tihana
Attachments:

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

Checkbox group 2 months 4 weeks ago #254116

  • Topic Author
  • mrperfectpz
  • Offline
  • Gold Breezer
  • Gold Breezer
  • Posts: 411
  • Thanks: 0
Hi Tihana, I need the checkbox group values to appear in a textarea in order they are checked please.

Many Thanks

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

Checkbox group 2 months 3 weeks ago #254133

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

go to checkbox->Advanced->Actionscript->check Custom:

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) // here you can add further dependencies
          {
               vals = opts[o].value;
          }
          if(vals=="value1") 
{
 ff_getElementByName('nameoftextarea').value=ff_getElementByName('nameoftextarea')+"\n"+ "value1";
}
 else if(vals=="value2") {
 ff_getElementByName('nameoftextarea').value=ff_getElementByName('nameoftextarea').value + "\n" + "value2";
}
else if(vals=="value3") {
ff_getElementByName('nameoftextarea').value=ff_getElementByName('nameoftextarea').value + "\n" + "value3";
}
          }
            break;
        default:;
    } // switch
} // ff_nameofcheckbox_action

Please replace:
-nameoftextarea with name of your textarea (not title)
-nameofcheckbox with name of checkbox (not title)
-value1,value2,value3 with values of your checkbox

Regards,
Tihana

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

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