I can't copy values from databasejoin-multiselect-dropdown to textarea

Hi,

I have urgent problem to solve how to search/filter on my list1 by field that is databasejoin-multi-select-dropdown - it is mentioned in other thread. So this doesn't work actually.

The one way i try to find solution is copy values from field1={ccjom_cc_szkolenia___multipersons_raw} - databasejoin-multiselect-dropdown to field2={ccjom_cc_szkolenia___test1} that is textarea, this if i do this should solve problem with searching/filtering.

I try php plugin for my form1 but this does't work, this returns NULL.
I don't know why this doesn't returns values so i did something similar in email plugin for form1 also and this returns values.

My code is:

$db =& JFactory::getDBO();
$recipient2 = '{ccjom_cc_szkolenia___multipersons_raw}';
$query = "SELECT GROUP_CONCAT(`email`) FROM `ccjom_users` WHERE `id` IN ($recipient2)";

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

$query = "UPDATE `ccjom_cc_szkolenia` SET `test1`=$result";
$db->setQuery($query);
$db->query();

I have code for email plugin very similar that returns emails values:

$db =& JFactory::getDBO();
$recipient2 = '{ccjom_cc_szkolenia___multipersons_raw}';
$query = "SELECT GROUP_CONCAT(`email`) FROM `ccjom_users` WHERE `id` IN ($recipient2)";

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

return $result;

Can i get any tip what is wrong with my php code and idea with copying values from field1 to field2?
 

Attachments

  • Zaznaczenie_504.png
    Zaznaczenie_504.png
    31.8 KB · Views: 383
  • Zaznaczenie_505.png
    Zaznaczenie_505.png
    36.5 KB · Views: 376
See the other thread, do a var_dump on $recipient2.
I think it's containing something like a//**//b
 
Hi,
In other thread: calc element:
When my code in calc element is:
$db =& JFactory::getDBO();
$recipient2 = '{ccjom_cc_szkolenia___multipersons_raw}';
var_dump($recipient2);
exit;
$query = "SELECT GROUP_CONCAT(`name`) FROM `ccjom_users` WHERE `id` IN ($recipient2)";

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

this returns:
string(39) "{ccjom_cc_szkolenia___multipersons_raw}"
 
Try without tablename___ part. That gets stripped off when we write the data out to the table, so I think in onAfterProcess you'll need to use just the element name part.

Or try using $formModel->getElementData('tablename___elementname', true) to get the raw value, rather than using placeholders.

-- hugh
 
Oh, many thanks
I try without tablename___ part and this works:
Code:

$db =& JFactory::getDBO();

$recipient2 = '{multipersons}';
$id = '{ccjom_cc_szkolenia___id}';

// $formModel->getElementData('ccjom_cc_szkolenia___multipersons', true)
// var_dump($recipient2);
// exit;

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

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

// var_dump($result);
// exit;
//return $result;

$query1 = "UPDATE `ccjom_cc_szkolenia` SET `test`='$result' WHERE `id`='$id'";

$db->setQuery($query1);
$db->query();
-------------------------------------------------------------------------------
But could you else write me how to use in my code:
$formModel->getElementData('ccjom_cc_szkolenia___multipersons', true)

I am not very advanced with this and i have more numbers forms where i need php plugin...
 
PHP:
But could you else write me how to use in my code:
$formModel->getElementData('ccjom_cc_szkolenia___multipersons', true)

I am not very advanced with this and i have more numbers forms where i need php plugin...

I don't know what you are asking for?

Does it return a value? If so, what is the value? As usual, the best way to go about it is to use ...

var_dump($whatever);exit;

... to dump whatever value you get to the screen, so you can see exactly how it is formatted.

Just as a note ... there really is a finite limit on how much code help we can give you on a Standard subscription. That's one of the differences between Standard and Pro. In Standard, we can point you in the right direction, and give you some custom code help, but we can't write much code for you, or work on anything very complex. So if you find yourself posting a thread starting with "urgent help", followed by 20 lines of code you need help with ...

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top