Hello,
I ran against some issues with the file component (in my case in the backend). There were actually 2 issues:
- When clicking on the 'new upload' button, nothing happened and noticed there was a javascript error in the console (Could not find the upload div)
- (After fixing that). The show/hide functionality for the 'new upload' and the 'browse' elements was not working properly
After reviewing the code in /dom/html/form/input/file/default.php, I made the following changes to the code and after that it is working properly:
The following is around line 94 of the code (changes have been commented, and code no longer required/changed have been commented out)
if (!$isNew)
{
// Added to show/hide the whole image and not only the link
$html .= ''
. '<div id="' . $btnId . '"'
. (!$isNew?' style="display:block;"':'')
. '>';
$html .= JDom::_("html.link.button", array(
//'link_js' => '$(' . $uploadDivId . ').show();$(' . $btnId . ').hide();',
// Changed to use jQuery() to access the functions as in some situations it cannot find the div
'link_js' => 'jQuery("#' . $uploadDivId . '").show();jQuery("#' . $btnId . '").hide();',
'content' => JText::_('New upload'),
'icon' => 'image',
'styles' => array()//,
// Not needed anymore here as the button ID is assigned to the whole block
//'domId' => $btnId
));
// Added to close the block
$html .= '</div>';
}
And similar a bit lower under that:
if (!$isNew)
{
$html .= JDom::_("html.link.button", array(
//'link_js' => '$(' . $uploadDivId . ').hide();$(' . $btnId . ').show()',
// Changed to use jQuery() to access the functions as in some situations it cannot find the div
'link_js' => 'jQuery("#' . $uploadDivId . '").show();jQuery("#' . $btnId . '").hide();',
'content' => JText::_('Cancel'),
'icon' => 'image',
'styles' => array(),
'domId' => $btnCancel
));
}
Kind regards,
Misha