Cascadingdropdown for an databasejoin element that is multiselect - how to do?

Hi,

I need cascadingdropdown element = field2 (that element should include emails of some amount of persons) for an databasejoin element = field1 - that dbj element is multiselect dropdown (that dbj element includes some amount of names of persons that are our workers).

I can create cascading dropdown element that works when an element databasejoin is dropdown (single dropdown - not multiselect dropdown) --- this is on my screen shoots.

I try find how to do - how get automatically values in a field2 - emails of persons that are choosen in field databasejoin-multiselect-dropdown?

Is this possible in any easier way that using php-plugin that should find emails in SQL database?
 

Attachments

  • Zaznaczenie_490.png
    Zaznaczenie_490.png
    32.3 KB · Views: 330
  • Zaznaczenie_491.png
    Zaznaczenie_491.png
    33.7 KB · Views: 325
Hi,
I have also problem with email-plugin on my form - this send an email only to first person from my multiselect dropdown - not for all choosen persons - what i exactly need.
My code is:


PHP:
$db =& JFactory::getDBO();
$recipient2 = '{ccjom_cc_szkolenia___multipersons_raw}';
 
$query = "SELECT `email` FROM `ccjom_users` WHERE `id` = " . $db->Quote($recipient2);
$db->setQuery($query);
$result = $db->loadResult();
return $result;

{ccjom_cc_szkolenia___multipersons_raw} - is my field1 = databasejoin to joomla users db with multiselect dropdown (this includes names of our workers)

Can someone help me to modify this SQL in email plugin for my form?
 

Attachments

  • Zaznaczenie_492.png
    Zaznaczenie_492.png
    37.2 KB · Views: 321
Hi,
Can i get a small answer - is this possible or can be possible in nearest future --- Cascadingdropdown for an databasejoin element that is multiselect ?:confused:

-----------------------
I need to choose - multiselect choose of users from Joomla users table and next i need in any way to get automatically their email addresses..., i have no idea how to do it,
 
May be is possible to write php code for sending email - to users choosen as multiselect -- post#2 - it would be enought for now?
 
Try

$x=$this->data['ccjom_cc_szkolenia___multipersons'];
$y= str_replace('</li><li>',',',$x);
$z = strip_tags($y);
return $z;
 
Troester:
This (your code) returns names (Names of users) - ccjom_cc_szkolenia___multipersons - include names,
i need return emails...

Added:
when code is:
$x=$this->data['ccjom_cc_szkolenia___multipersons'];
$y= str_replace('</li><li>',',',$x);
$z = strip_tags($y);
var_dump($z);
exit;
return $z;

I get:
string(88) "CC Agnieszka Sblue,CC Andrzej Pwhite,CC Anna Sorange,CC Ewa Ggreen,CC Jaros?aw Wbrown"

That are name-s of users - should be emails,

Emails of users are in table: ccjom_users___email,
 
Hi Troester - i try this:
$db =& JFactory::getDBO();
$recipient2 = '{ccjom_cc_szkolenia___multipersons_raw}';

$query = "SELECT `email` FROM `ccjom_users` WHERE
`id` IN ($recipient2)";

//`id` = " . $db->Quote($recipient2);
//`id` IN ($recipient2)";
//var_dump($query);
//exit;

//$db->setQuery($query);
//$result = $db->loadResult();
//return $result;

$db->setQuery($query);
$column= $db->loadColumn();
var_dump($column);
exit;
return $column;

This returns multiple emails:
array(4) { [0]=> string(16) "e.green@candc.pl" [1]=> string(18) "d.blue@candc.pl" [2]=> string(17) "w.white@candc.pl" [3]=> string(20) "d.red@candc.pl" }

but when i use: (at the end of code):
//var_dump($column);
//exit;
return $column;

This doesn't send emails to those addresses, can you advice me what is wrong?
 
Hi,
It looks i found code that works:
$db =& JFactory::getDBO();
$recipient2 = '{ccjom_cc_szkolenia___multipersons_raw}';

$query = "SELECT GROUP_CONCAT(`email`) FROM `ccjom_users` WHERE `id` IN ($recipient2)";

//SELECT `email`
//SELECT GROUP_CONCAT(name) AS names
//`id` = " . $db->Quote($recipient2);
//`id` IN ($recipient2)";
//var_dump($query);
//exit;

$db->setQuery($query);
$result = $db->loadResult();
var_dump($result);
exit;

return $result;

//$db->setQuery($query);
//$column= $db->loadColumn();
//var_dump($column);
//exit;
//return $column;

the result is a string with emails:
string(194) "e.green@candc.pl,d.blue@candc.pl,w.white@candc.pl,a.orange@candc.pl,d.black@candc.pl,a.yellow@candc.pl,a.brown@candc.pl,a.darkgreen@candc.pl,a.mediumblue@candc.pl,k.red@candc.pl"
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top