Development Blog

Get Field Label Text in Joomla 2.5 JForm

I’m switching back and forth between projects in Joomla 3.X and Joomla 2.5… to get the field label text (not the HTML tags, just the text) from a JFormField object is simple enough in Joomla 3.X, since the class has a getAttribute() method, so:

$field = $form->getField('myfield');
$label = $field->getAttribute('label');

I could be mistaken, but didn’t see the same functionality in Joomla 2.5. The closest I’ve come up with is to get the full label, then strip out the HTML tags, like:

$field = $form->getField('myfield');
$label = strip_tags($field->__get('label'));

…which is ugly, but seems to work in the cases I’ve tested. Anyone know of a better way to access the element attributes directly in Joomla 2.5?

Joomla 2.5 – stuck redirecting to index.php for 404

I’ve just spent the last few hours troubleshooting why a Joomla 2.5 site I’m working on was redirecting to the home index.php page for bad URLs instead of loading my template’s custom error.php page. Instead of the 404 response code, it was returning a 303 response: 303 See other

From what I can tell, it was because in the Global Configuration settings, I had the site offline for testing. So apparently even if logged in as a user who can view the offline site, it still won’t load the error page until the site is back online. When I put it back online, the 404 response was loading as expected… now I know.

Joomla 2.5 Component Categories Sub-Nav

I recently found Joomla’s feature to easily add custom component-specific nested Categories. It makes for a quick way to create categories similar to what is used in com_content and an interface to manage those categories without having to build it all manually. You can use JForm to easily add a select menu of your custom categories. The categories interface can even include a custom sub-menu to easily get back to the rest of your component.

Read more

Joomla! 2.5 Toolbar Popup Link Icon

Today I needed to add a new toolbar button to a custom Joomla! component. In the past, I’ve used a more convoluted method of overriding the submitbutton() (or Joomla.submitbutton) JavaScript function and triggering the modal popup manually, but stumbled upon a better solution.

Read more

Ajax Form Submission in Joomla 2.5 with jQuery

I’m developing a custom c-commerce component for Joomla 2.5, and today was struggling with using Ajax from my admin lists. I wanted to make small changes to the list via Ajax without having to reload the entire page – publish state, deletes, quick edits, etc. To handle the Ajax form submissions, I was using jQuery and the jQuery Form Plugin.

Read more

Custom Admin Quickicon in Joomla! 2.5

I recently had to dig up how to add a custom admin Quickicon (the icon links on the left side of the Administrator section’s control panel) in Joomla 2.5. In previous versions, I’d just built a custom admin module for each icon. Now, there seems to be a somewhat easier way.

Read more

Forcing NULL date field values in Joomla 1.7 JTable

I’ve been upgrading my Joomla! knowledge from version 1.5 to 1.7, and ran into an issue with JTable where my date fields, though they had a NULL default in the database, were getting saved with a value of ‘0000-00-00’ on save, presumably because the value was being sent as an empty string.

Read more

Joomla Component Preferences Button

I ran into a frustrating issue today while developing a custom component where the Preferences button would not show up. In case I’m not the only one that encounters this, here’s what happened…

Read more

Custom 404 Error Pages in Joomla

I’ve recently had to build custom 404 pages for a few Joomla sites, and it seems like every time it comes up, I have to dig around for the information again and look up how I did it last time. I’m posting the details here so it’s all in one place for me, and hopefully it saves you some time and effort as well.

Read more