Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7846481
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T17:35:38+00:00 2026-06-02T17:35:38+00:00

Situation : I needed to add form with POST method to CMS page. I

  • 0

Situation: I needed to add form with POST method to CMS page. I created custom hook and a module displaying the form successfully. Then I need to react to user input errors eg. when user doesn’t enter email address I need to detect it, display the whole page again together with the form and with “errors” in user input clearly stated.

Problem: The problem is to display the WHOLE page again with connected information (eg. about errors etc.). In the module PHP file when I add this kind of code,

return $this->display(__FILE__, 'modulename.tpl');

it (naturally) displays ONLY the form, not the whole CMS page with the form.

In case of this code,

Tools::redirectLink('cms.php?id_cms=7');

I can’t get to transfer any information by GET neither POST method.

$_POST['test'] = 1;
Tools::redirectLink('cms.php?id_cms=7&test');

I tried to assign to smarty variables too

$smarty->assign('test', '1');

(I need to use it in .tpl file where the form itself is created) but no way to get it work.

{if isset($test)}...,
{if isset($smarty.post.test)}...,
{if isset($_POST['test'])}... {* neither of these conditionals end up as true *}

Even assigning a GET parameter to url has no impact, because there is link rewriting to some kind of friendly url I guess, no matter I included other argument or not. ([SHOPNAME]/cms.php?id_cms=7&test -> [SHOPNAME]/content/7-cmspage-name)

My question is: is there a way to “redirect” or “reload” current page (or possibly any page generally) in prestashop together with my own data included?

I kind of explained the whole case so I’m open to hear a better overall solution than my (maybe I’m thinking about the case in a wrong way at all). This would be other possible answer.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T17:35:40+00:00Added an answer on June 2, 2026 at 5:35 pm

    The simplest method would be to use javascript to validate the form – you can use jQuery to highlight the fields that are in error; providing visual feedback on how the submission failed. In effect you don’t allow the user to submit the form (and thus leave the page) until you’re happy that the action will succeed. I assume that you will then redirect to another page once a successful submission has been received.

    There’s lots of articles and how-tos available for using javascript, and indeed jQuery for form validation. If you want to keep the site lean and mean, then you can provide an override for the CMS controller and only enqueue the script for the specific page(s) you want to use form validation on.

    If the validation is complex, then you might be best using AJAX and just reloading the form section of your page via a call to your module. Hooks aren’t great for this kind of thing, so you might want to consider using an alternative mnethod to inject your code onto the cms page. I’ve written a few articles on this alternative approach which can be found on my prestashop blog

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Situation: In Drupal, when you use Views module, it restricts to display Search Form
Okay, so I had a situation where I needed to add some cloned DOM
I'm using ASP.NET MVC 2 and stuck with the situation when needed to store
Situation: A custom Master Document content type inherits from Document The Master Document content
I have recently been in a situation where I needed to perform an operation
Please do add a comment if more information is needed to answer this question.
I came across a situation doing some advanced collision detection, where I needed to
I have situation to extend the Enumerable class in c# to add the new
I came across a strange situation today where I needed a function to not
I m stuck in a situation where I needed (column1 and column2) or (column1

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.