Jump to content

problem with prestashop form


felek

Recommended Posts

Hello, I create form using form helper:

 $fields_form[0]['form'] = array(
          'legend' => array(
              'title' => $this->l('Create Delivery Pacage'),
          ),
          'input' => array(
              array(
                  'type' => 'text',
                  'label' => $this->l('Adresat'),
                  'name' => 'odbiorca',
                  'size' => 20,
                  'required' => true
              ),
              ........more here 
            ),
           'submit' => array(   
            'title' => $this->l('Generate Delivery'),  
             'name' => 'generate_pdf_siodemka',  
             'class' => 'button'
           )); 
$helper = new HelperForm(); $helper->fields_value...... 

and return it

return $helper->generateForm($fields_form);

all data show correctly in my form.

Now inside my function i want to use that data. I want to check if form was submitted:

if(Tools::isSubmit('generate_pdf_siodemka))
{
do stuff here
}

But when i run my form do stuff here is running twice!

How can I prevent that fom happening is there any unset function at the end and i should call it ?

Edited by felek (see edit history)
Link to comment
Share on other sites

That is probably because your controller is also submitting data from your contact page.

In this case you might be better of editing your controller or overriding it via your overriding folder.

 

Check your controller at public_html/controllers/front/ContactController.php

This states at the very beginning:

public function postProcess()
	{
		if (Tools::isSubmit('submitMessage'))
		{

This might be causing you the double submit.

Link to comment
Share on other sites

I try do it on context and cookie still no results its very frustrating .....

From Your post hidden vale and what check number and than some how change it still if help i try.

 

Any way one more question regarding form.

i can create context

$this->context->cookie->__set('click',0);

When form is click

$this->context->cookie->__set('click',1);

And i will just check click cookie. But is there any way to setlifetime of that variable for example 1 minute ?

Or some one have any other idea ?

Edited by felek (see edit history)
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...