THEMA:

preset checkbox group 10 Jahre 3 Wochen her #90032

  • Autor
  • Werbewunder
  • Offline
  • Junior Boarder
  • Junior Boarder
  • Registered
  • Beiträge: 36
  • Dank erhalten: 0
Hi Team,
I have a checkbox-group called wtgroup with a list of days and assigned values like unix-days (1 to 6 and sunday is 0).
Saving the date writes the list of values comma seperated into the databes (f.e 2,4,5,6)
No I like to load the data from database and preset the checkboxes aligned to the values of the database.
How can I do this? For a single checkbox I found solution, but it should be a checkbox-group now.
Thanks a lot

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Re: preset checkbox group 10 Jahre 3 Wochen her #90189

  • Syno
  • Offline
  • Platinum Boarder
  • Platinum Boarder
  • Registered
  • Beiträge: 2186
  • Dank erhalten: 209
Hello,

this is very similar to selectlists.

Assuming you want to preset the the checkboxoptions with all users in your db, you can do the following in a before form piece:

$this->execPieceByName('ff_InitLib');
global $listdata;
//fetch the data from DB
$rows = ff_select("SELECT id, username FROM jos_users");

// create the group definition string
$listdata = "0;Please select a value;0\n";

for ($i = 0; $i < count($rows); $i++) {
$listdata .= "0;{$rows[$i]->username};{$rows[$i]->id}\n";
}



Now go to your checkboxgroup and add the following line to the group definition field:

<?php global $listdata; return $listdata; ?>

This example will generate checkboxgroup options based on the values which are fetched from the user table.
So all you need to do is customize the $listdata string as desired.


Let me know if this helps.

Regards,
Syno

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

  • Seite:
  • 1
Moderatoren: ForumSupport
Ladezeit der Seite: 0.048 Sekunden

Angebot

Sommer Special! Alle Mitgliedschaften zum Sonderpreis!

Prio Support, alle Extensions und alle Templates in einem Paket.

Hier geht's zur Bestellung

Crosstec hilft sparen!

Falls Sie neu bei Crosstec sind aber bereits einen Formulargenerator bei einem anderen Hersteller gekauft haben, dann bekommen sie von uns einen Rabatt von 25% auf unsere 1-Jahres und Pro-Mitgliedschaften

Wie Sie an den Rabatt kommen?

Schreiben Sie uns einfach eine kurze Email mit beigelegten Kaufbeleg (z.B. PayPal Quittung) an sales@crosstec.org.

Live Support Chat Opened!

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

Wir unterstützen die Joomla Community

Crosstec unterstützt weltweit alle offiziellen Joomla! User Groups und Organisatoren von Joomla! Days die bei Joomla.org registriert sind.

Falls das auf dich zutrifft und du eines unserer Produkte brauchst, schreib uns eine kurze Email an info@crosstec.org und du bekommst eine Flatrate-Mitgliedschaft geschenkt!