JForm :: getInstance无法加载文件 [英] JForm::getInstance could not load file

查看:61
本文介绍了JForm :: getInstance无法加载文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将表单组件制作到joomla中,在其中我将放置一个文本框,一个编辑器和一个按钮。
i为此表格创建视图文件,并且该组件已成功安装。但是当我单击以将此表格显示在前端时,出现错误显示,如:

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:

一个过期的书签/收藏夹
a输入了错误的地址
a搜索引擎具有该网站的过期列表
您无权访问此页面
转到主页

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

主页

如果问题仍然存在,请联系此站点的系统管理员,并在下面报告错误。

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

500 JForm :: getInstance无法加载文件
您的支持

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

推荐答案

1。首先检查您的表单xml文件

前端路径: components\com_< name_of_component> \models\forms form< formname> .xml

后端路径: administrator\components\com_< name_of_component> ; \models\forms\< formname> .xml

示例(Joomla 3.4.3):管理员\组件\com_users\模型\窗体\group.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。检查模型类

方法 getForm()负责加载表单(该表单

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

前端路径: components\com_< name_of_component> \models\< modelname>。 php

后端路径: administrator\components\com_< name_of_component> \models\< ; modelname> .php

示例(Joomla 3.4.3): administrator\components\com_users\ models\group.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;
}

这篇关于JForm :: getInstance无法加载文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆