I will take an example if I have a table of Members, instead of the first .$result[$i]. I would like to get for instance the equivalent of the FirstName+ space + LastName information
and instead of the second .$result[$i]. I would like to get the id of the member.
How should I modify your example?
Thanks in advance
yves
Hi Markus
thank you for the info, but I still some help for the columns. I tried to use the * in the select or to use the field names, but it doesn't load properly the variable.
The number of records is correct in the preview (see attached print screen, I get the 13 lines in the list, which corresponds to the number of records in my table, but the lines of the select list are empty.
the code I have (using the 3 field names I am interested in for the list):
$this->execPieceByName('ff_InitLib'); //Include BreezingForms Library
$db = JFactory::getDBO();//Get Database Object
//Create your own query here
$db->setQuery('Select id,title,price From adint_osmembership_plans ');
$result = $db->loadColumn(); //load the result from the query
$test = "";
$test = "0;Please make a selection;0\n";
for ($i = 0; $i < count($result); $i++)
{
$test .= "0;".$result[$i]->title." ".$result[$i]->price.";".$result[$i]->id."\n";
}
function ff_setSelectList($name, $value)
{
global $ff_processor;
for ($r = 0; $r < $ff_processor->rowcount; $r++)
{
$row =& $ff_processor->rows[$r];
if ($row->name==$name)
$row->data2 = $value;
unset($row);
} // for
} // ff_setSelectList
ff_setSelectList('listepremiumfreemium', $test);
Thank you Markus,
It works fine.
I put the final script here below for info.
Now, I have seen that I need to make second select list based on the result of the first one to make it easier for the user.
Let's say I will use the resulting "id" of the choice made in the first list to filter the elements to insert into the second select list
I have seen that you already provided a script for 2 select boxes in crosstec.org/en/forums/3-breezingforms-f...mboboxes.html#128913
But I have difficulties to combine both scripts due to the fact:
- both elect boxes are built dynamically
- and I don't need to test the result of the first box 'choice1' of your example, but simply to select 2 fields of another table (table2) for the text + the id of that table2 for the value of the row in the select box. it will then be a second formula for the new select list like:
Later in that thread I am extending it to a 4-dimensional selection but I guess based on your description, the 2-dimensional is fine ("make"/"model" relation).
Please check it out and let me know what you think as it might be completely different from what you got so far.
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!