Skip to content

Commit

Permalink
Merge pull request techjoomla#189 from ankush-maherwal/release-1.4.3
Browse files Browse the repository at this point in the history
Bug techjoomla#205 fix: For list type of field, value is shown on list and deta…
  • Loading branch information
ankush-maherwal authored Oct 18, 2019
2 parents c8ad742 + 1f84c0d commit 1d07825
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 24 deletions.
2 changes: 1 addition & 1 deletion admin_language/en-GB/en-GB.com_tjfields.ini
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ COM_TJFIELDS_FORM_DESC_EDITOR_WIDTH="Set width"
COM_TJFIELDS_FORM_LBL_EDITOR_HEIGHT="Height"
COM_TJFIELDS_FORM_DESC_EDITOR_HEIGHT="Set height"
COM_TJFIELDS_FORM_LBL_FIELD_SIZE="Size"
COM_TJFIELDS_FORM_DESC_FIELD_SIZE="Set maximum allowed file size (In MB) e.g 10, 20"
COM_TJFIELDS_FORM_DESC_FIELD_SIZE="Set size"
COM_TJFIELDS_FORM_LBL_FIELD_MAXLENGTH="Max Length"
COM_TJFIELDS_FORM_LBL_FIELD_MIN="Min Value"
COM_TJFIELDS_FORM_DESC_FIELD_MIN="Min Value"
Expand Down
2 changes: 1 addition & 1 deletion administrator/models/fields.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ protected function getListQuery()
else
{
$search = $db->Quote('%' . $db->escape($search, true) . '%');
$query->where('( a.type LIKE ' . $search . ' )');
$query->where('( a.label LIKE ' . $search . ' )');
}
}

Expand Down
2 changes: 1 addition & 1 deletion administrator/models/forms/types/forms/text.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<fieldset name="params">
<field name="default" type="text" label="COM_TJFIELDS_FORM_LBL_FIELD_DEFAULT" description="COM_TJFIELDS_FORM_DESC_FIELD_DEFAULT"/>
<field name="size" type="number" label="COM_TJFIELDS_FORM_LBL_FIELD_SIZE" description="COM_TJFIELDS_FORM_DESC_FIELD_SIZE"/>
<field name="maxlength" type="number" label="COM_TJFIELDS_FORM_LBL_FIELD_MAXLENGTH" description="COM_TJFIELDS_FORM_DESC_FIELD_SIZE"/>
<field name="maxlength" type="number" label="COM_TJFIELDS_FORM_LBL_FIELD_MAXLENGTH" description="COM_TJFIELDS_FORM_DESC_FIELD_MAXLENGTH"/>
<field name="hint" type="text" label="COM_TJFIELDS_FORM_LBL_TEXT_FIELD_PLACEHOLDER" description="COM_TJFIELDS_FORM_DESC_TEXT_FIELD_PLACEHOLDER"/>
</fieldset>
</fields>
Expand Down
8 changes: 7 additions & 1 deletion site/layouts/fields/sql.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@
}

$options = $field->getOptions();

if (empty($options))
{
return;
}

$fieldOptions = array();

foreach ($options as $option)
Expand Down Expand Up @@ -51,4 +57,4 @@
echo "<br>";
}
}
}
}
43 changes: 23 additions & 20 deletions site/layouts/fields/subform.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,33 +44,36 @@
</div>
<div class='col-xs-6'>
<?php
if ($field->type == 'List' || $field->type == 'Radio')
if (isset($subformData[$field->getAttribute('name')]))
{
$fieldXml = $form->getFieldXml($field->getAttribute('name'));
$field->value = $subformData[$field->getAttribute('name')];
if ($field->type == 'List' || $field->type == 'Radio')
{
$fieldXml = $form->getFieldXml($field->getAttribute('name'));
$field->value = $subformData[$field->getAttribute('name')];

$layout = new JLayoutFile('list', JPATH_ROOT . '/components/com_tjfields/layouts/fields');
echo $layout->render(array('fieldXml' => $fieldXml, 'field' => $field));
}
elseif ($field->type == 'Checkbox')
{
if ($subformData[$field->getAttribute('name')])
$layout = new JLayoutFile('list', JPATH_ROOT . '/components/com_tjfields/layouts/fields');
echo $layout->render(array('fieldXml' => $fieldXml, 'field' => $field));
}
elseif ($field->type == 'Checkbox')
{
?>
<input type="checkbox" checked="checked">
<?php
if ($subformData[$field->getAttribute('name')])
{
?>
<input type="checkbox" checked="checked">
<?php
}
else
{
?>
<input type="checkbox">
<?php
}
}
else
{
?>
<input type="checkbox">
<?php
echo $subformData[$field->getAttribute('name')];
}
}
else
{
echo $subformData[$field->getAttribute('name')];
}
?>
</div>
<?php
Expand All @@ -81,4 +84,4 @@
<hr>
<?php
}
}
}

0 comments on commit 1d07825

Please sign in to comment.