I need to use field type sql with param sql_filter (see https://docs.joomla.org/SQL_form_field_type)
I query added condition with values in this field.
Condition not added.
Joomla 3.x
I fix this with edit the file: \libraries\joomla\form\fields\sql.php.
My code add with comments //SDI.
Labels |
Added:
J3 Issue
|
Labels |
Removed:
J3 Issue
|
Labels |
Added:
J3 Issue
|
Title |
|
This is code example from my case
<field
name="catid"
type="category"
extension="com_content"
multiple="false"
default=""
size="10"
label="JCATEGORY"
description="MOD_SDI_SELART_CATEGORY_DESC"
>
<option value="">JOPTION_ALL_CATEGORIES</option>
</field>
<field
name="artids"
type="sql"
multiple="true"
default=""
size="10"
label="JGLOBAL_ARTICLES"
description="MOD_SDI_SELART_ARTICLES_DESC"
sql_select="id, title"
sql_from="#__content"
sql_filter= "catid"
sql_where="state=1"
key_field="id"
value_field="title"
sql_default_catid=""
>
</field>
I try this from module.
I can reproduce this problem but your code doesn't work in order to solve this bug.
It is ok now. But the first part of your code should be:
$curfrm = $this->form;
if (is_array($filters)) :
foreach ($filters as $i => $v)
{
$filterval = $curfrm->getValue ($v, $group);
if (!is_null($filterval))
$filters[$i]= $v . '=' . $filterval;
}
endif;
If you don't add "if (is_array($filters)) " then you will have a warning: Invalid argument supplied for foreach() in other sql fields, which don't use the "sql-filter".
Someone should include this fix in the next version of joomla.
However, it doesn't work dynamically, meaning it doesn't change the values after the page is loaded, so it is not very useful.
Status | New | ⇒ | Discussion |
Labels |
Removed:
J3 Issue
|
Labels |
Added:
J3 Issue
|
Status | Discussion | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2019-04-30 07:16:31 |
Closed_By | ⇒ | franz-wohlkoenig |
Why the solution is not implemented in Joomla core file sql.php yet?
Is this related #22241? Please provide an XML example in your case.