felek Posted February 8, 2015 Share Posted February 8, 2015 (edited) 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 February 8, 2015 by felek (see edit history) Link to comment Share on other sites More sharing options...
helldog2004 Posted February 8, 2015 Share Posted February 8, 2015 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 More sharing options...
felek Posted February 8, 2015 Author Share Posted February 8, 2015 (edited) Well my form is in AdminOrder controller. i use hook to alter it Maybe i should put some hidden value and after submit a form unset it ? Is it possible? Edited February 8, 2015 by felek (see edit history) Link to comment Share on other sites More sharing options...
helldog2004 Posted February 8, 2015 Share Posted February 8, 2015 Take a look here, this might help you further https://www.prestashop.com/forums/topic/291810-a-href-whit-toolsissubmit/ Cheers Link to comment Share on other sites More sharing options...
felek Posted February 8, 2015 Author Share Posted February 8, 2015 (edited) 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 February 9, 2015 by felek (see edit history) Link to comment Share on other sites More sharing options...
felek Posted February 10, 2015 Author Share Posted February 10, 2015 Solved using redirect just after pdf prints stupid but works... Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now