Contents
How is the HTML value treated in Joomla?
The HTML value attribute is treated somewhat differently from other HTML attributes. As outlined in the Basic form guide, in the Joomla Form instance the XML form structure (defined by the form definition XML file) is held separately from the form pre-fill data (passed in the bind () method).
Where is the$ group parameter in Joomla?
The $group parameter which appears in several Form API methods refers to the name attribute of the tag in the form definition XML. Examples of this approach can be seen in the Joomla MVC tutorial Adding an Image step and many of the Joomla core components. Note that fieldsets and field groups are independent.
How to remove fields from a Joomla form?
You can remove fields from the Form definition by calling removeField () to remove a specific field or removeGroup () to remove all the fields within a specified field group. There are a number of methods which allow you to access various aspects of the Form instance data.
How to submit a sample form in Joomla?
Once installed navigate on your browser to your Joomla site and add the URL parameter &option=com_sample_form3, which should display the form and allow you to enter data and submit the form. The comments in the code should make it clear what’s going on.
How do you define a form in Joomla?
Firstly, you need to define your form in XML using Joomla Standard form field types. See the component code below for an example. In basic terms, each field element in your XML file maps to an HTML (mostly “input”) element in the form, with the XML field attributes mapping to the (input) element attributes.
The user enters data into your HTML form and clicks on the submit button. The browser generates an HTTP POST request to the URL specified in the element and passes to the server in POST parameters the values entered by the user; each parameter keyed by the “name” attribute of the HTML input element.