Upon successful submission my form redirects to the success message placeholder on the same page just above the form. I would like to grab the value of the name field and display it in the success message. I’ve done this before using FormItRetriever and it was dead simple but in those cases the success message was on a different page and so far I’ve been unable to get it to work when redirecting to the same page.



Maybe you can set a custom placeholder in a hook snippet instead.

   &successMessage=`Thank you [[!]], for the message.` 
<form id="myform" action="[[~[[*id]]]]" method="post">    
       <label for="name">Name</label> 
       <input type="text" name="name" value="[[!]]"> 
   <input type="submit" value="Send"> 

Snippet hookSetNamePlaceholder

$name = $hook->getValue('name');
$hook->modx->setPlaceholder('', $name);
return true;

That worked perfectly. Thank you very much.

This topic was automatically closed 2 days after discussion ended and a solution was marked. New replies are no longer allowed. You can open a new topic by clicking the link icon below the original post or solution and selecting “+ New Topic”.