Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

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

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 following user(s) said Thank You: admin

Please Log in or Create an account to join the conversation.

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

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
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!!!

Please Log in or Create an account to join the conversation.

Last edit: by JoomGuy.

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

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

Please Log in or Create an account to join the conversation.

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

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
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!!!

Please Log in or Create an account to join the conversation.

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

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
Fixed.
Coding is now a piece of cake

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Time to create page: 0.087 seconds

Although I found this tool some time ago I just started learning experimenting and building this first component on Monday and now on Thursday afternoon it's already online. Although I already had a working version done with another tool this is much easier to build and at the end you have the freedom to own your own component. Once you know how to use Cook you will boost your productivity as the learning curve is really moderate compared to many other tools.
Giori (Forum)

Get Started