Forums

on submit - clear form, stay on the same page

rodsdesign 07 Jan, 2009
Hi,

I'm using a form on in a module at the bottom of every page for beta feedback.

Once a form is submitted, I want the form to clear but the user stay on the page where they submitting the form.
how/where can I do that...

help ??🙂

thanks as always

Rod
GreyHead 07 Jan, 2009
Hi rodsdesign,

I guess that you'll need to capture the current page url and then use it as a redirect url in ChronoForms. I recall that there was some discussion of this a couple of weeks ago - but I don't remember if it was about Modules.

Bob
rodsdesign 07 Jan, 2009
Hey Bob,

yep - can capture the current page - no worries... but its the URL redirection I'm struggling with.

I tried putting:
<input type="hidden" name="referring" value="<?php echo $_SERVER['REQUEST_URI']; ?>">

as a field then

<META HTTP-EQUIV="Refresh" CONTENT="0; URL=<?php $_POST[referring]; ?>">

in the on submit after email box... didn't work😟
rodsdesign 07 Jan, 2009
SOLVED.

in the on submit after email i put:
<META HTTP-EQUIV="Refresh" CONTENT="0; URL=http://sitename.com<?php echo $_POST[referring]; ?>">


that did the trick... sorry to post the question before I really worked on it...

thanks Bob
GreyHead 08 Jan, 2009
Hi rodsdesign,

Great, glad you solved it.

Just for future information, there are two other ways of doing the redirect. Joomla has a redirect command that will do an immediate redirect
<?php
global $mainframe;
$mainframe->redirect( $url, [$message,] [$message type]);
?>
So in this case you could write
>?php
$url = JURI::Base().DS; // I'm not certain about the DS??
$url .= getString('referring', 'index.php', 'post'); // add a default and some validation
$mainframe->redirect( $url, "Thanks for your submission", 'info');
?>

ChronForms also has a redirect URL that you can set
<?php
$rows[0]->redirecturl = 'some url';
?>
This doesn't allow you to send a message but has the advantage that it won't redirect until the email & database processing is complete so you cam set it anywhere in the OnSubmit code boxes (even in the email template).

Bob
This topic is locked and no more replies can be posted.

VPS & Email Hosting 20% discount
hostinger