Jump to content

i want to use ajax instead of using _postProcess of prestashop 1.5


toanloau

Recommended Posts

i create the flollowing form:

http://1drv.ms/1d3cfja

with code:

 $fields_form[0]['form'] = array(
            'legend' => array(
                'title' => $this->l('Settings'),
            ),
            'input' => array(
                array(
                    'type' => 'text',
                    'label' => $this->l('Configuration value:'),
                    'name' => 'MYMODULE_NAME',
                    'size' => 20,
                    'required' => true,
                    'hint' => $this->l('Invalid characters:').' <>;=#{}', // as user mouseover in this selector this will show a description.
                    'desc' => $this->l('To add "tags," click in the field, write something'),
                ),
                array(
                    'type' => 'radio',
                    'label' => $this->l('Authentication:'),
                    'name' => 'authentication',
                    'required' => false,
                    'is_bool' => true,
                    'class' => 't',
                    'values' => array(
                        array(
                            'id' => 'auth_on',
                            'value' => 1,
                            'label' => $this->l('Yes')
                        ),
                        array(
                            'id' => 'auth_off',
                            'value' => 0,
                            'label' => $this->l('No')
                        )
                    )
                ),
                array(
                    'type' => 'text',
                    'name' => 'username',
                    'label' => $this->l('Username:'),
                ),
                array(
                    'type' => 'password',
                    'name' => 'password',
                    'label' => $this->l('Password:'),
                ),
            ),           
            'submit' => array(
                'title' => $this->l('Save'),
                'class' => 'button'
            )
        );
        
         $fields_form[1]['form'] = array(
            'legend' => array(
                'title' => $this->l('Settings01'),
            ),
        'submit' = array (
              'title' => $this->l('index'),
                'class' => 'button'
          ),
            
         );
        $helper = new HelperForm();
        
        // Module, token and currentIndex
        $helper->module = $this;
        $helper->name_controller = $this->name;
        $helper->token = Tools::getAdminTokenLite('AdminModules');
        $helper->currentIndex = AdminController::$currentIndex.'&configure='.$this->name;
        
        // Language
        $helper->default_form_language = $default_lang;
        $helper->allow_employee_form_lang = $default_lang;
        
        // Title and toolbar
        $helper->title = $this->displayName;
        $helper->show_toolbar = true;        // false -> remove toolbar
        $helper->toolbar_scroll = true;      // yes - > Toolbar is always visible on the top of the screen.
        $helper->submit_action = 'submit'.$this->name;
        $helper->toolbar_btn = array(
            'save' =>
            array(
                'desc' => $this->l('Save'),
                'href' => AdminController::$currentIndex.'&configure='.$this->name.'&save'.$this->name.
                '&token='.Tools::getAdminTokenLite('AdminModules'),
            ),
            'back' => array(
                'href' => AdminController::$currentIndex.'&token='.Tools::getAdminTokenLite('AdminModules'),
                'desc' => $this->l('Back to list')
            )
        );
return $helper->generateForm($fields_form);

Normally there is a private _postProcess function which processes form data which then calls the function getContent reload pages, but i want index button to be clicked, i will to do with ajax.

Please help me!post-760111-0-75147800-1392884931_thumb.jpg

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...