JForm::getInstance could not load file

13,713

1. First check your form xml-file

Front-end path: components\com_<name_of_component>\models\forms\<formname>.xml

Back-end path: administrator\components\com_<name_of_component>\models\forms\<formname>.xml

Example (Joomla 3.4.3): administrator\components\com_users\models\forms\group.xml

<?xml version="1.0" encoding="utf-8"?>
<form>
    <fieldset>
        <field name="id" type="hidden"
            default="0"
            required="true"
            readonly="true"
        />

        <field name="title" type="text"
            required="true"
            description="COM_USERS_GROUP_FIELD_TITLE_DESC"
            label="COM_USERS_GROUP_FIELD_TITLE_LABEL"
            size="40"
        />

        <field name="parent_id" type="groupparent"
            description="COM_USERS_GROUP_FIELD_PARENT_DESC"
            label="COM_USERS_GROUP_FIELD_PARENT_LABEL"
            required="true"
        />

        <field name="actions" type="hidden"
            multiple="true"
        />

        <field name="lft" type="hidden"
            filter="unset"
        />
        <field name="rgt" type="hidden"
            filter="unset"
        />
    </fieldset>
</form>

2. Check your model class

The method getForm() is responsible for loading the form (the form xml-file mentioned above).

Front-end path: components\com_<name_of_component>\models\<modelname>.php

Back-end path: administrator\components\com_<name_of_component>\models\<modelname>.php

Example (Joomla 3.4.3): administrator\components\com_users\models\group.php

/**
 * Method to get the record form.
 *
 * @param   array    $data      An optional array of data for the form to interogate.
 * @param   boolean  $loadData  True if the form is to load its own data (default case), false if not.
 *
 * @return  JForm   A JForm object on success, false on failure
 *
 * @since   1.6
 */
public function getForm($data = array(), $loadData = true)
{
    // Get the form.
    $form = $this->loadForm(
        'com_users.group', 
        'group', 
        array(
            'control' => 'jform', 
            'load_data' => $loadData)
        );

    if (empty($form))
    {
        return false;
    }

    return $form;
}
Share:
13,713
deval oza
Author by

deval oza

Updated on June 04, 2022

Comments

  • deval oza
    deval oza about 2 years

    I am making a form component into joomla.In which i will put one textbox and one editor and one button. i create the view file for this form and the component is successfully install.but when i click to display this form onto the front end,there is an error display like:

    "The requested page cannot be found. An error has occurred while processing your request.

    You may not be able to visit this page because of:

    an out-of-date bookmark/favourite a mistyped address a search engine that has an out-of-date listing for this site you have no access to this page Go to the Home Page

    Home Page

    If difficulties persist, please contact the System Administrator of this site and report the error below.

    500 JForm::getInstance could not load file" thanks for your support