Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 437 Vote(s) - 3.52 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Prestashop 1.6 - Create Forms with more than 1 submit buttons

#1
I'm trying to implement a form in a tab on the back office on prestashop 1.6.

I've succeeded creating the form using the Helper class and all works fine. However, of what I see the helper class only allows 1 submit button. For my needs I need to use more than 1 that perform different actions on the postProcess() part of the controller. Any help on achieving that would be much appreciated. Here is my render form that works with a single submit button:

public function renderForm()
{
$fields_form = array(
'form' => array(
'legend' => array(
'title' => $this->l('Contact details'),
'icon' => 'icon-envelope'
),
'input' => array(
array(
'type' => 'text',
'label' => $this->l('Account owner'),
'name' => 'BANK_WIRE_OWNER',
),
array(
'type' => 'textarea',
'label' => $this->l('Details'),
'name' => $this->l('test2'),
'desc' => $this->l('Such as bank branch, IBAN number, BIC, etc.')
),
array(
'type' => 'textarea',
'label' => $this->l('Bank address'),
'name' => 'BANK_WIRE_ADDRESS',
),
),
'submit' => array(
'title' => $this->l('Save'),
)
),
);

$helper = new HelperForm();
$helper->show_toolbar = false;
$helper->table = $this->table;
$lang = new Language((int)Configuration::get('PS_LANG_DEFAULT'));
$helper->default_form_language = 1;
$helper->fields_value['BANK_WIRE_OWNER'] = "";
$helper->fields_value['test2'] = "";
$helper->fields_value['BANK_WIRE_ADDRESS'] = "";
$this->fields_form = array();
$helper->submit_action = 'test';

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

#2
You can create more forms on the same screen.

return $helper->generateForm(array($fields_form1, $fields_form2, $fields_form3));

Or if you really need to reuse the same form, you can add `<select>` as a last form element, that will give you a choice of action to be executed by submit button.
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through