0
$fields_form = array(
        'form' => array(
            'legend' => array(
                'title' => $this->l('Configure Settings'),
                'icon' => 'icon-cogs'
            ),
            'description' => $form_desc,
        'input' => array(
            array(
              'type'     => 'text',
              'label'    => $this->l('textfield1'),
              'name'     => 'username',
              'size'     => 50,
              'class' => 'fixed-width-xxl',
              'required' => true
          ),
            array(
              'type'     => 'password',
              'label'    => $this->l('textfield2'),
              'name'     => 'password',
              'size'     => 50,
              'class' => 'fixed-width-xl',
              'required' => true,
          ),
            ),
          'submit' => array(
              'name' => 'submitconfigureoptions',
              'title' => $this->l('Save'),
              'icon' => 'process-icon-save',
              'class' => 'btn btn-default pull-right'

          ),
        )
    );

我有一个带有四个输入文本字段和一个提交按钮的表单。因此,提交表单后,我在输入文本字段中输入的相同值必须在页面刷新后显示在表单中。

4

1 回答 1

0

要在 Helper Form 中保留值,您可以使用以下代码:

$helper->fields_value['field_name'] = 'field_value';

在 generateForm() 函数之前添加此代码,这将在页面加载之前将值添加到您的字段中。

于 2017-02-23T05:00:23.623 回答