Crezzur.com Posted December 23, 2015 Share Posted December 23, 2015 (edited) Hey all, I am trying to process data inputed by a user in a .tpl file. Located in the module section (backoffice) I will need help with this since i only know how to do this using PHP only. Process i need: User press on the save button (settings.tpl page) The form gets submitted to mymodulename.php Public function $postProcces grabs the data send. Send the data back to settings.tpl with a confirmation that settings are saved. settings.tpl file: (after pressing submit it should send its data to $postProcces) <!-- $ns_url is the current url in browser -> $_SERVER['REQUEST_URI']; --> <form action="{$ns_url}" method="post"> <!-- Display data after submit --> {if isset($datatest)} {$datatest} {/if} <!-- Data that need to be send to postProcess(); --> <input type="hidden" name="test" value="test werkt" /> <!-- Save button, post form --> <button type="submit" value="Submit" name="submit_requestform">Save</button> </form> mymodulename.php: (when the save button is clicked, it need to send data to $postProcces) public function postProcess() { // Check if form is submitted if (Tools::isSubmit('submit_requestform')) { // Grab value inside "test" $result = Tools::getValue('test'); // Assign value to datatest variable for use in tpl file $this->smarty->assign('datatest', $result); // Send data back to settings.tpl $output = $this->context->smarty->fetch($this->local_path.'views/templates/admin/settings.tpl'); return $output.$this->renderForm(); } } Edited December 23, 2015 by Crezzur (see edit history) 1 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