# Forums | Mahara Community

## Developers / Using help on forms

Deleted user
Posts: 112

09 August 2014, 6:35 AM

I am trying to use help on a form I am creating, and the documentation (wiki) does not match what is in the source code.  I just want one line to be help with maybe an weblink also.  I entered my text into the "help" array item, but I am not sure if that is correct.  Mahara included artefacts have "help" set to "true".  I don't really want to create a separate file for each form item.

Posts: 348
##### Re: Using help on forms

09 August 2014, 9:18 AM

You are probably looking for something like this:

'elementname' => array(
'type' => 'text',
'title' => get_string('elementtitle', 'artefact.test'),
'description' => get_string('elementdesc', 'artefact.test', '<a href="http://www.google.com">', '</a>'),
...
)

and in the 'artefact.test.php' language file there should be:

$string['elementtitle'] = 'Element title',$string['elementdesc'] = 'One line help with the %slink to Google%s...'; // first and second %s are being replaced by arguments 3 and 4 in the appropriate get_string function...

The above example should give you a text field with label 'Element title' and a description (help line in your case) underneath the element...

I think that you should include the form in your template .tpl file with the argument "safe", like this:

{form|safe}

HTH, Gregor

Deleted user
Posts: 112
##### Re: Using help on forms

10 August 2014, 3:05 PM

Thanks for your help.  Is there any way to do the string substitution without the using the language file?  I am still in the  developmental phase and I just want to write in the strings for right now.

Posts: 348
##### Re: Using help on forms

10 August 2014, 10:39 PM

Of course.

Use hard-coded strings instead of get_string function (from my example above):

'elementname' => array(
'type' => 'text',
'title' => 'Element title',
...
)

But I would advice against that. I'm trying to avoid using hard-coded strings because you might easily miss one of them, when exchanging them with get_string function...

HTH, Gregor

Deleted user
Posts: 112
##### Re: Using help on forms

10 August 2014, 10:59 PM

Actually, what I figured out is that if you want to use HTML in the strings (and have it process the html), use the html versions of the fields.

label -> labelhtml

help -> helphtml

I don't know if it also applies to title and description, since those two I don't use.  All of my items are radio input, which does not use title, and I don't want the description to be under the item.  I want it to be an icon that displays text when the mouse is over it, or is a link that can clicked.  I know that using a language file is better, but in this instance it would add a level of complication.    I am just working on dialog boxes outside of any plug (to mark them up), and I have not figured out how to access that language files that way.

Posts: 348
##### Re: Using help on forms

11 August 2014, 12:52 AM

In my Europass plugin I needed a form element which consists of several checkboxes with icons instead of text (see a screenshot at: https://mahara.org/artefact/file/download.php?file=384997)

This is done by using regular checkbox Pieform elements and form template where those elements are arragned and icons are added.

Do you want to achieve something similar? It would be helpful if you could provide a sketch of a form (or at least the arrangement of form elements that you want to achieve).

HTH, Gregor

Deleted user
Posts: 112
##### Re: Using help on forms

11 August 2014, 1:42 AM

Deleted user
Posts: 112
##### Re: Using help on forms

11 August 2014, 1:45 AM

I have actually figured out how to do it within pieforms.  I just add the text to either the labelhtml or helphtml, depending on if I want the icon next to the label or after the radio box selections.   And with variables and language files, like you showed me, it will make the final code very clean.

Melissa

Posts: 348
##### Re: Using help on forms

11 August 2014, 3:01 AM

Sorry for the image. I've put it on public page of Europass plugin... See: https://mahara.org/user/anzeljg/europass-plugin

HTH, Gregor
9 results