Jump to content

[Help Needed] Helper Form - supporting multi fieldset


AppleEater

Recommended Posts

Hi,

I've read the http://doc.prestashop.com/display/PS15/HelperForm guide, but couldn't understand if it's possible to add several fieldset tags to one help form. for instance, the equivalence of :

<form>
<fieldset>
<input type="text" id="field1">
<input type="text" id="field2">
</fieldset>
<fieldset>
<input type="text" id="field3">
<input type="text" id="field4">
</fieldset>
</form>

Link to comment
Share on other sites

Hi,

 

You need to do something like that:

$this->fields_form[0]['form'] = array(
			'tinymce' => true,
			'legend' => array(
				'title' => $this->l('Setting'),
				'icon' => 'icon-cogs'
			),
			'submit' => array(
				'name' => $helper->submit_action,
				'title' => $this->l('Save')
			),
			'input' => array()
		);

$this->fields_form[1]['form'] = array(
			'tinymce' => true,
			'legend' => array(
				'title' => $this->l('Setting'),
				'icon' => 'icon-cogs'
			),
			'submit' => array(
				'name' => $helper->submit_action,
				'title' => $this->l('Save')
			),
			'input' => array()
		);

You see the $this->fields_form[1]['form'] ? The 0 and 1 it's the index of a fieldset. If you add a 2, you will see three fieldset.

  • Like 1
Link to comment
Share on other sites

Thank you very much for the answer, but how do connect this to all the variables initilizations?

		$helper = new HelperForm();
		$helper->show_toolbar = false;
		$helper->table =  $this->name;
		$helper->module = $this;


		$lang = new Language((int)Configuration::get('PS_LANG_DEFAULT'));
		$helper->show_toolbar = false;
		$helper->module = $this;
		$helper->default_form_language = $lang->id;
		$helper->allow_employee_form_lang =
			Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') ? Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') : 0;
		$this->fields_form = array();

		// Module, token and currentIndex
		$helper->identifier = $this->identifier;
		$helper->submit_action = 'btnSubmit';
		$helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false)
				.'&configure='.$this->name
				.'&tab_module='.$this->tab
				.'&module_name='.$this->name;
		$helper->token = Tools::getAdminTokenLite('AdminModules');

		$helper->tpl_vars = array(
			'fields_value' => $this->getConfigFieldsValues(),
			'languages' => $this->context->controller->getLanguages(),
			'id_language' => $this->context->language->id,
			'uri' => $this->getPathUri()
		);

		return $helper->generateForm(array($fields_form));

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...