Welcome, Guest
Username: Password: Remember me

TOPIC: [FIXED] Issues with dom.html.form.input.file (+fix)

[FIXED] Issues with dom.html.form.input.file (+fix) 24 Nov 2012 10:00 #5630

  • blue-canoe
  • blue-canoe's Avatar
  • Offline
  • Senior Member
  • Posts: 57
  • Thank you received: 16
  • Karma: 7
Hello,

I ran against some issues with the file component (in my case in the backend). There were actually 2 issues:
  1. 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)
  2. (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
The administrator has disabled public write access.
The following user(s) said Thank You: admin

Re: Issues with dom.html.form.input.file (+fix) 24 Nov 2012 14:24 #5633

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
  • Karma: 64
Hi Misha, thanks again for all of your contributions!

I wonder, in this case particularly, please could you provide your cook builder config options so we can pin-point the exact nature of your issue and whether it is version/config option specific?

Many thanks,

Gez
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!
Last Edit: 24 Nov 2012 14:24 by JoomGuy.
The administrator has disabled public write access.

Re: Issues with dom.html.form.input.file (+fix) 25 Nov 2012 07:25 #5636

  • blue-canoe
  • blue-canoe's Avatar
  • Offline
  • Senior Member
  • Posts: 57
  • Thank you received: 16
  • Karma: 7
Hi Gez,

I used all the default settings in Cook. So 'CMS' for compatibility. And I noticed it has 'Mootools' as the JS framework (which might be part of the issue).

The thing is I can't regenerate the component (with different settings) again as I am working locally for a while now and already made a lot of customisations to the code.

Kind regards,

Misha
The administrator has disabled public write access.

Re: Issues with dom.html.form.input.file (+fix) 25 Nov 2012 07:54 #5637

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
  • Karma: 64
Hi misha,

Yes, I think the issue is that you are using cook 1.5 with mootools because in the link_js, I can see that the JS is actually a jQuery function.

As you said, I wouldn't advise swapping to cook 2.0 mid-project. You could however swap JS to jQuery which might help!

Anyway, thanks again!

Gez
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!
The administrator has disabled public write access.

Re: Issues with dom.html.form.input.file (+fix) 03 Dec 2012 12:24 #5777

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
Fixed.
Coding is now a piece of cake
The administrator has disabled public write access.
Time to create page: 0.075 seconds

Get Started