Customize front-end forms

In Music Collection 2.2 front-end forms (available in Community versions) can be customized: you can add descriptions to each field, to guide your users on how to fill out the forms, and you can mark fields as "required" if necessary.

How to make a field "required"

For this, you'll have to open certain file with your favourite text or code editor.

The file for the ARTIST form is

/components/com_muscol/views/artist/tmpl/form.php

The file for the ALBUM form is

/components/com_muscol/views/album/tmpl/form.php

The file for the SONG form is

/components/com_muscol/views/song/tmpl/form.php

Once you know what fields you want to make mandatory for the user to fill out, you must localize it on the form.php file. It will be an "input" HTML element, or a "select" element. The name of the field will help you recognise that it's what you are looking for. For instance, on the Artist form, the name of the field that contains the Artist Name is called "artist_name".

To make a field mandatory, you just need to add the class "required" on the CLASS attribute of the element. So, if an element has the class="text_area", to make it mandatory you need to turn this into: class="text_area required".

That's all you need, Music Collection will handle all the rest of the process for you.

How to add descriptions to the fields

This is done through the LANGUAGE file. The main language file for Music Collection (and the one you will be using if your site is in english) is:

/language/en-GB/en-GB.com_muscol.ini

This file contains all the language strings found in Music Collection. Some of these are empty strings, which means that they won't show up on the site.

Open this file with a PLAIN text editor. You'll find a number of sentences that end with the key "EXPLANATION". For instance, you'll find

ARTIST_NAME_EXPLANATION=The artist name. This is a required field.

This sentence is what shows up under the Artist Name field, on the Artist front-end form. This one is already filled out by default, but you can change the description if you want.

You'll find other sentences untranslated, such as:

ARTIST_GENRE_EXPLANATION=

or

ARTIST_CITY_EXPLANATION=

The names of the keys are self-explanatory. To add a description to that field (genre and city in the examples above, for the Artist form), just add your text after the "=" character. For instance:

ARTIST_GENRE_EXPLANATION=Define the main genre of this artist

or

ARTIST_CITY_EXPLANATION=Where does this artist come from?

If you are using Joomla 1.6, remember to enquote the sentences, like so:

ARTIST_GENRE_EXPLANATION="Define the main genre of this artist"

or

ARTIST_CITY_EXPLANATION="Where does this artist come from?"