<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://docs.sandbox.joomla.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Dieda2</id>
	<title>Joomla! Documentation - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://docs.sandbox.joomla.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Dieda2"/>
	<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/Special:Contributions/Dieda2"/>
	<updated>2026-09-06T03:21:43Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.0</generator>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Archived:Creating_a_simple_module/Adding_Form_Fields&amp;diff=324255</id>
		<title>Archived:Creating a simple module/Adding Form Fields</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Archived:Creating_a_simple_module/Adding_Form_Fields&amp;diff=324255"/>
		<updated>2016-08-12T10:50:22Z</updated>

		<summary type="html">&lt;p&gt;Dieda2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Chunk25:Creating a Simple Module for Joomla!2.5 - Contents}}&lt;br /&gt;
&lt;br /&gt;
Form fields give a great deal of customisation in Joomla and for modules are the sole way of allowing the user to tweak the module to the needs of their site.&lt;br /&gt;
&lt;br /&gt;
== What are Form Fields? ==&lt;br /&gt;
In {{JVer|1.5}} form fields were called parameters - and a comparison between form fields and parameters can be found on [[Standard_form_field_and_parameter_types|this page]]. A complete list of form fields can be found on [[Standard_form_field_types|this page]].&lt;br /&gt;
&lt;br /&gt;
== Adding Form Fields to the module ==&lt;br /&gt;
In this case we are going to extend our previous example using the database to provide a list of languages for the user to select from. To allow this to happen we will use the SQL form field type (full details for this on the [[SQL_form_field_type|SQL Form Field]] docs page).&lt;br /&gt;
&lt;br /&gt;
First of all we are going to add a form field into our xml file. Remember those config tags that we added in earlier? Well now inside these tags we are going to add the following code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;fields name=&amp;quot;params&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;fieldset name=&amp;quot;basic&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;field&lt;br /&gt;
               name=&amp;quot;lang&amp;quot;&lt;br /&gt;
               type=&amp;quot;sql&amp;quot;&lt;br /&gt;
               default=&amp;quot;1&amp;quot;&lt;br /&gt;
               label=&amp;quot;Select a language&amp;quot;&lt;br /&gt;
               query=&amp;quot;SELECT id AS value, lang FROM #__helloworld&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;/fieldset&amp;gt;&lt;br /&gt;
&amp;lt;/fields&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This selects the languages from the database table and allows the user to choose which one from a select element.&lt;br /&gt;
&lt;br /&gt;
If you were to install the module as it is now you would see if you were to access the module in the backend of Joomla that a dropdown had appeared (although picking an option won&#039;t affect the module at the moment).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Note:&#039;&#039; The form field parameters are stored for each module in the #__modules table under the params field as json encoded string.&lt;br /&gt;
&lt;br /&gt;
Because of the Joomla! module rendering method, when we are inside the mod_helloworld.php program, we have the same variables in scope that we have in the renderModule() method of the JModuleHelper class (libraries/joomla/application/module/helper.php). Among these we have the $params variable defined as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
$params= new JRegistry;&lt;br /&gt;
$params-&amp;gt;loadJSON($module-&amp;gt;params);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Hence, we can always access the $params variable although it&#039;s never been defined in our code.&lt;br /&gt;
&lt;br /&gt;
Now lets make the form field do something!&lt;br /&gt;
&lt;br /&gt;
Lets go into the mod_helloworld.php and retrieve the parameter (note you &#039;&#039;&#039;cannot&#039;&#039;&#039; retrieve the parameter in the helper), and then pass it into the helper function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
  * This retrieves the lang parameter we stored earlier. Note the second part&lt;br /&gt;
  * which states to use the default value of 1 if the parameter cannot be&lt;br /&gt;
  * retrieved for some reason&lt;br /&gt;
**/&lt;br /&gt;
$language = $params-&amp;gt;get(&#039;lang&#039;, &#039;1&#039;);&lt;br /&gt;
$langid = $params-&amp;gt;get(&#039;id&#039;, &#039;1&#039;);&lt;br /&gt;
$hello    = modHelloWorldHelper::getHello($langid);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now lets edit our database query in the helper file to reflect our parameter choice&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
// Obtain a database connection&lt;br /&gt;
$db = JFactory::getDbo();&lt;br /&gt;
// Retrieve the shout - note we are now retrieving the id not the lang field.&lt;br /&gt;
$query = $db-&amp;gt;getQuery(true)&lt;br /&gt;
            -&amp;gt;select($db-&amp;gt;quoteName(&#039;hello&#039;))&lt;br /&gt;
            -&amp;gt;from($db-&amp;gt;quoteName(&#039;#__helloworld&#039;))&lt;br /&gt;
            -&amp;gt;where(&#039;id = &#039;. (int)$params); //here $params is the parameter passed to the helper getHello function&lt;br /&gt;
// Prepare the query&lt;br /&gt;
$db-&amp;gt;setQuery($query);&lt;br /&gt;
// Load the row.&lt;br /&gt;
$result = $db-&amp;gt;loadResult();&lt;br /&gt;
//Return the Hello&lt;br /&gt;
return $result;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Form fields give the user an easy way to customise the module to their sites settings. This allows the modules scope to be increased as well for many languages and applications.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;noinclude&amp;gt;&lt;br /&gt;
[[Category:Module Development]]&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Dieda2</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Archived:Creating_a_simple_module/Adding_Form_Fields&amp;diff=324254</id>
		<title>Archived:Creating a simple module/Adding Form Fields</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Archived:Creating_a_simple_module/Adding_Form_Fields&amp;diff=324254"/>
		<updated>2016-08-12T10:49:05Z</updated>

		<summary type="html">&lt;p&gt;Dieda2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Chunk25:Creating a Simple Module for Joomla!2.5 - Contents}}&lt;br /&gt;
&lt;br /&gt;
Form fields give a great deal of customisation in Joomla and for modules are the sole way of allowing the user to tweak the module to the needs of their site.&lt;br /&gt;
&lt;br /&gt;
== What are Form Fields? ==&lt;br /&gt;
In {{JVer|1.5}} form fields were called parameters - and a comparison between form fields and parameters can be found on [[Standard_form_field_and_parameter_types|this page]]. A complete list of form fields can be found on [[Standard_form_field_types|this page]].&lt;br /&gt;
&lt;br /&gt;
== Adding Form Fields to the module ==&lt;br /&gt;
In this case we are going to extend our previous example using the database to provide a list of languages for the user to select from. To allow this to happen we will use the SQL form field type (full details for this on the [[SQL_form_field_type|SQL Form Field]] docs page).&lt;br /&gt;
&lt;br /&gt;
First of all we are going to add a form field into our xml file. Remember those config tags that we added in earlier? Well now inside these tags we are going to add the following code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;fields name=&amp;quot;params&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;fieldset name=&amp;quot;basic&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;field&lt;br /&gt;
               name=&amp;quot;lang&amp;quot;&lt;br /&gt;
               type=&amp;quot;sql&amp;quot;&lt;br /&gt;
               default=&amp;quot;1&amp;quot;&lt;br /&gt;
               label=&amp;quot;Select a language&amp;quot;&lt;br /&gt;
               query=&amp;quot;SELECT id AS value, lang FROM #__helloworld&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;/fieldset&amp;gt;&lt;br /&gt;
&amp;lt;/fields&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This selects the languages from the database table and allows the user to choose which one from a select element.&lt;br /&gt;
&lt;br /&gt;
If you were to install the module as it is now you would see if you were to access the module in the backend of Joomla that a dropdown had appeared (although picking an option won&#039;t affect the module at the moment).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Note:&#039;&#039; The form field parameters are stored for each module in the #__modules table under the params field as json encoded string.&lt;br /&gt;
&lt;br /&gt;
Because of the Joomla! module rendering method, when we are inside the mod_helloworld.php program, we have the same variables in scope that we have in the renderModule() method of the JModuleHelper class (libraries/joomla/application/module/helper.php). Among these we have the $params variable defined as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
$params= new JRegistry;&lt;br /&gt;
$params-&amp;gt;loadJSON($module-&amp;gt;params);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Hence, we can always access the $params variable although it&#039;s never been defined in our code.&lt;br /&gt;
&lt;br /&gt;
Now lets make the form field do something!&lt;br /&gt;
&lt;br /&gt;
Lets go into the mod_helloworld.php and retrieve the parameter (note you &#039;&#039;&#039;cannot&#039;&#039;&#039; retrieve the parameter in the helper), and then pass it into the helper function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
  * This retrieves the lang parameter we stored earlier. Note the second part&lt;br /&gt;
  * which states to use the default value of 1 if the parameter cannot be&lt;br /&gt;
  * retrieved for some reason&lt;br /&gt;
**/&lt;br /&gt;
$language = $params-&amp;gt;get(&#039;lang&#039;, &#039;1&#039;);&lt;br /&gt;
$langid = $params-&amp;gt;get(&#039;id&#039;, &#039;1&#039;);&lt;br /&gt;
$hello    = modHelloWorldHelper::getHello($langid);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now lets edit our database query in the helper file to reflect our parameter choice&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
// Obtain a database connection&lt;br /&gt;
$db = JFactory::getDbo();&lt;br /&gt;
// Retrieve the shout - note we are now retrieving the id not the lang field.&lt;br /&gt;
$query = $db-&amp;gt;getQuery(true)&lt;br /&gt;
            -&amp;gt;select($db-&amp;gt;quoteName(&#039;hello&#039;))&lt;br /&gt;
            -&amp;gt;from($db-&amp;gt;quoteName(&#039;#__helloworld&#039;))&lt;br /&gt;
            -&amp;gt;where(&#039;id = &#039;. int($params)); //here $params is the parameter passed to the helper getHello function&lt;br /&gt;
// Prepare the query&lt;br /&gt;
$db-&amp;gt;setQuery($query);&lt;br /&gt;
// Load the row.&lt;br /&gt;
$result = $db-&amp;gt;loadResult();&lt;br /&gt;
//Return the Hello&lt;br /&gt;
return $result;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Form fields give the user an easy way to customise the module to their sites settings. This allows the modules scope to be increased as well for many languages and applications.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;noinclude&amp;gt;&lt;br /&gt;
[[Category:Module Development]]&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Dieda2</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Archived:Creating_a_simple_module/Adding_Form_Fields&amp;diff=324253</id>
		<title>Archived:Creating a simple module/Adding Form Fields</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Archived:Creating_a_simple_module/Adding_Form_Fields&amp;diff=324253"/>
		<updated>2016-08-12T10:47:29Z</updated>

		<summary type="html">&lt;p&gt;Dieda2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Chunk25:Creating a Simple Module for Joomla!2.5 - Contents}}&lt;br /&gt;
&lt;br /&gt;
Form fields give a great deal of customisation in Joomla and for modules are the sole way of allowing the user to tweak the module to the needs of their site.&lt;br /&gt;
&lt;br /&gt;
== What are Form Fields? ==&lt;br /&gt;
In {{JVer|1.5}} form fields were called parameters - and a comparison between form fields and parameters can be found on [[Standard_form_field_and_parameter_types|this page]]. A complete list of form fields can be found on [[Standard_form_field_types|this page]].&lt;br /&gt;
&lt;br /&gt;
== Adding Form Fields to the module ==&lt;br /&gt;
In this case we are going to extend our previous example using the database to provide a list of languages for the user to select from. To allow this to happen we will use the SQL form field type (full details for this on the [[SQL_form_field_type|SQL Form Field]] docs page).&lt;br /&gt;
&lt;br /&gt;
First of all we are going to add a form field into our xml file. Remember those config tags that we added in earlier? Well now inside these tags we are going to add the following code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;fields name=&amp;quot;params&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;fieldset name=&amp;quot;basic&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;field&lt;br /&gt;
               name=&amp;quot;lang&amp;quot;&lt;br /&gt;
               type=&amp;quot;sql&amp;quot;&lt;br /&gt;
               default=&amp;quot;1&amp;quot;&lt;br /&gt;
               label=&amp;quot;Select a language&amp;quot;&lt;br /&gt;
               query=&amp;quot;SELECT id AS value, lang FROM #__helloworld&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;/fieldset&amp;gt;&lt;br /&gt;
&amp;lt;/fields&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This selects the languages from the database table and allows the user to choose which one from a select element.&lt;br /&gt;
&lt;br /&gt;
If you were to install the module as it is now you would see if you were to access the module in the backend of Joomla that a dropdown had appeared (although picking an option won&#039;t affect the module at the moment).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Note:&#039;&#039; The form field parameters are stored for each module in the #__modules table under the params field as json encoded string.&lt;br /&gt;
&lt;br /&gt;
Because of the Joomla! module rendering method, when we are inside the mod_helloworld.php program, we have the same variables in scope that we have in the renderModule() method of the JModuleHelper class (libraries/joomla/application/module/helper.php). Among these we have the $params variable defined as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
$params= new JRegistry;&lt;br /&gt;
$params-&amp;gt;loadJSON($module-&amp;gt;params);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Hence, we can always access the $params variable although it&#039;s never been defined in our code.&lt;br /&gt;
&lt;br /&gt;
Now lets make the form field do something!&lt;br /&gt;
&lt;br /&gt;
Lets go into the mod_helloworld.php and retrieve the parameter (note you &#039;&#039;&#039;cannot&#039;&#039;&#039; retrieve the parameter in the helper), and then pass it into the helper function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
  * This retrieves the lang parameter we stored earlier. Note the second part&lt;br /&gt;
  * which states to use the default value of 1 if the parameter cannot be&lt;br /&gt;
  * retrieved for some reason&lt;br /&gt;
**/&lt;br /&gt;
$language = $params-&amp;gt;get(&#039;lang&#039;, &#039;1&#039;);&lt;br /&gt;
$langid = $params-&amp;gt;get(&#039;id&#039;, &#039;1&#039;);&lt;br /&gt;
$hello    = modHelloWorldHelper::getHello($langid);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now lets edit our database query in the helper file to reflect our parameter choice&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
// Obtain a database connection&lt;br /&gt;
$db = JFactory::getDbo();&lt;br /&gt;
// Retrieve the shout - note we are now retrieving the id not the lang field.&lt;br /&gt;
$query = $db-&amp;gt;getQuery(true)&lt;br /&gt;
            -&amp;gt;select($db-&amp;gt;quoteName(&#039;hello&#039;))&lt;br /&gt;
            -&amp;gt;from($db-&amp;gt;quoteName(&#039;#__helloworld&#039;))&lt;br /&gt;
            -&amp;gt;where(&#039;id = &#039;. int($params)); //here $params is the parameter passed to the helper function&lt;br /&gt;
// Prepare the query&lt;br /&gt;
$db-&amp;gt;setQuery($query);&lt;br /&gt;
// Load the row.&lt;br /&gt;
$result = $db-&amp;gt;loadResult();&lt;br /&gt;
//Return the Hello&lt;br /&gt;
return $result;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Form fields give the user an easy way to customise the module to their sites settings. This allows the modules scope to be increased as well for many languages and applications.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;noinclude&amp;gt;&lt;br /&gt;
[[Category:Module Development]]&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Dieda2</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Archived:Creating_a_simple_module/Adding_Form_Fields&amp;diff=324252</id>
		<title>Archived:Creating a simple module/Adding Form Fields</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Archived:Creating_a_simple_module/Adding_Form_Fields&amp;diff=324252"/>
		<updated>2016-08-12T10:46:39Z</updated>

		<summary type="html">&lt;p&gt;Dieda2: I have added the explanation of why the $params variable appears as available inside mod_helloworld.php despite it&amp;#039;s not been defined before inside the custom code. Also I have corrected the query inside the helper.php file and the function call.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Chunk25:Creating a Simple Module for Joomla!2.5 - Contents}}&lt;br /&gt;
&lt;br /&gt;
Form fields give a great deal of customisation in Joomla and for modules are the sole way of allowing the user to tweak the module to the needs of their site.&lt;br /&gt;
&lt;br /&gt;
== What are Form Fields? ==&lt;br /&gt;
In {{JVer|1.5}} form fields were called parameters - and a comparison between form fields and parameters can be found on [[Standard_form_field_and_parameter_types|this page]]. A complete list of form fields can be found on [[Standard_form_field_types|this page]].&lt;br /&gt;
&lt;br /&gt;
== Adding Form Fields to the module ==&lt;br /&gt;
In this case we are going to extend our previous example using the database to provide a list of languages for the user to select from. To allow this to happen we will use the SQL form field type (full details for this on the [[SQL_form_field_type|SQL Form Field]] docs page).&lt;br /&gt;
&lt;br /&gt;
First of all we are going to add a form field into our xml file. Remember those config tags that we added in earlier? Well now inside these tags we are going to add the following code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;fields name=&amp;quot;params&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;fieldset name=&amp;quot;basic&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;field&lt;br /&gt;
               name=&amp;quot;lang&amp;quot;&lt;br /&gt;
               type=&amp;quot;sql&amp;quot;&lt;br /&gt;
               default=&amp;quot;1&amp;quot;&lt;br /&gt;
               label=&amp;quot;Select a language&amp;quot;&lt;br /&gt;
               query=&amp;quot;SELECT id AS value, lang FROM #__helloworld&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;/fieldset&amp;gt;&lt;br /&gt;
&amp;lt;/fields&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This selects the languages from the database table and allows the user to choose which one from a select element.&lt;br /&gt;
&lt;br /&gt;
If you were to install the module as it is now you would see if you were to access the module in the backend of Joomla that a dropdown had appeared (although picking an option won&#039;t affect the module at the moment).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Note:&#039;&#039; The form field parameters are stored for each module in the #__modules table under the params field as json encoded string.&lt;br /&gt;
&lt;br /&gt;
Because of the Joomla! moudule rendering method, when we are inside the mod_helloworld.php program, we have the same variables in scope that we have in the renderModule() method of the JModuleHelper class (libraries/joomla/application/module/helper.php). Among these we have the $params variable defined as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
$params= new JRegistry;&lt;br /&gt;
$params-&amp;gt;loadJSON($module-&amp;gt;params);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Hence, we can always access the $params variable although it&#039;s never been defined in our code.&lt;br /&gt;
&lt;br /&gt;
Now lets make the form field do something!&lt;br /&gt;
&lt;br /&gt;
Lets go into the mod_helloworld.php and retrieve the parameter (note you &#039;&#039;&#039;cannot&#039;&#039;&#039; retrieve the parameter in the helper), and then pass it into the helper function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
  * This retrieves the lang parameter we stored earlier. Note the second part&lt;br /&gt;
  * which states to use the default value of 1 if the parameter cannot be&lt;br /&gt;
  * retrieved for some reason&lt;br /&gt;
**/&lt;br /&gt;
$language = $params-&amp;gt;get(&#039;lang&#039;, &#039;1&#039;);&lt;br /&gt;
$langid = $params-&amp;gt;get(&#039;id&#039;, &#039;1&#039;);&lt;br /&gt;
$hello    = modHelloWorldHelper::getHello($langid);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now lets edit our database query in the helper file to reflect our parameter choice&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
// Obtain a database connection&lt;br /&gt;
$db = JFactory::getDbo();&lt;br /&gt;
// Retrieve the shout - note we are now retrieving the id not the lang field.&lt;br /&gt;
$query = $db-&amp;gt;getQuery(true)&lt;br /&gt;
            -&amp;gt;select($db-&amp;gt;quoteName(&#039;hello&#039;))&lt;br /&gt;
            -&amp;gt;from($db-&amp;gt;quoteName(&#039;#__helloworld&#039;))&lt;br /&gt;
            -&amp;gt;where(&#039;id = &#039;. int($params)); //here $params is the parameter passed to the helper function&lt;br /&gt;
// Prepare the query&lt;br /&gt;
$db-&amp;gt;setQuery($query);&lt;br /&gt;
// Load the row.&lt;br /&gt;
$result = $db-&amp;gt;loadResult();&lt;br /&gt;
//Return the Hello&lt;br /&gt;
return $result;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Form fields give the user an easy way to customise the module to their sites settings. This allows the modules scope to be increased as well for many languages and applications.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;noinclude&amp;gt;&lt;br /&gt;
[[Category:Module Development]]&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Dieda2</name></author>
	</entry>
</feed>