checkbox group, values stored in different elements (CB column) (Solved)

  • Gilles361
  • Topic Author
  • Offline
  • Gold Boarder
  • Gold Boarder
  • Posts: 209
  • Thank you received: 5

Gilles361 created the topic: checkbox group, values stored in different elements (CB column) (Solved)

Hi,
I've a "checkbox group" element with 3 values (choices). I would like to display 3 columns in CB (ContentBuilder) and set "1" if for each selected item (hidden element). Ex.: choice 2 will set "1" to column 2 if selected, ...

1/ My solution (NOT OK)
Create choice1 to Choice3 hidden elements
Create "Desiderata" Checkbox Group Element
(VALUES)
0 ; 1 - PAS DE PRÉFÉRENCE ; 1 - PAS DE PRÉFÉRENCE
0 ; 2 - Plateforme (Atelier parcours routier) ; 2 - Plateforme (Atelier parcours routier)
0 ; 3 - Atelier test QCM et vidéo ; 3 - Atelier test QCM et vidéo

Desiderata "checkbox element", ACTION SCRIPT, "Change"
function ff_Desiderata_init() {
var Choix = ff_getElementByName('Desiderata').value;

// Recherche le Choix, si présent, Choix = "1"
if ( Choix.search("1 -") > 0 ) {
ff_getElementByName('Choix1').value = "1" ;}
if ( Choix.search("2 -") > 0) {
ff_getElementByName('Choix2').value = "1" ;}
if ( Choix.search("3 -") > 0) {
ff_getElementByName('Choix3').value = "1" ;}
} // ff_Desiderata_init

2/ I've tried with JS in my "checkbox group" but can't figure to get "checkbox group" value as a string value, in order to process Choice "1".

How to get "checkbox group" result in a string?
Or to address my need?

Thanks for your help
Gil
#239384
  • Gilles361
  • Topic Author
  • Offline
  • Gold Boarder
  • Gold Boarder
  • Posts: 209
  • Thank you received: 5

Gilles361 replied the topic: checkbox group, values stored in different elements (CB column)

function ff_Desiderata_action(element, action) {
opts=jQuery('[name="ff_nm_Desiderata[]"]:checked');

for (var o = 0; o < opts.length; o++) {
if(opts[o].value.search("1 -") >= 0) {
ff_getElementByName("Choix1").value = 1;
}
if(opts[o].value.search("2 -") >= 0) {
ff_getElementByName("Choix2").value = 1;
}
if(opts[o].value.search("3 -") >= 0) {
ff_getElementByName("Choix3").value = 1;
}
}
} // ff_Desiderata_action
#239459
Moderators: ForumSupporttomeperica
Time to create page: 0.054 seconds

New Icon Packs Category!

Crosstec is now offering icon packs.

If you are a paying subscriber, icon packs are automatically added to your account.

Check out our icon packs page!

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 and icon packs!

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