Buy Now
Sign in

After Submit-Refresh form and display message

tomaszciti , March 03 2015
T
tomaszciti 4
March 03 2015 #343573
Hi all,

Just a quick question regarding the issue I have had....

I had to refresh the form after "Submit" and display "Confirmation Message".

I think I solved it myself based on other topics on this forum, but I just want to "double-check" that my solution is right.

On Load

1) HTML Render Form

On Submit

1) Email (won't go into details here)

2) Custom code


<?php
$form->data = array();


3) HTML Render Form

4) Display Message

Is that the correct way to do this?

Can I use "HTML Render Form" twice without any issues? I have tried to use "Event Loop" or "Load Form", but had problems with both - "Load Form" did not display the same form, just displayed confirmation message and "Event Loop" displayed the form, but without confirmation message.

Thanks a lot.
GreyHead 63.4
March 03 2015 #343575
1
 Answer
Hi tomaszciti,

Looks OK to me.

You could change you code to
<?php
$form->data = array('show_message' => true);
?>

and then use an Event Loop plus a Custom Code element in the designer tab to show the message:
<?php
if ( isset($form->data['show_message']) && $form->data['show_message'] ) {
echo "<div>Put your message here</div>";
?>

Then the message will only show on a reload.

Bob
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much
T
tomaszciti 4
March 05 2015 #343664
Hi

Thanks a lot. By the way I have purchased the subscription
I found out though that there is a problem with using "HTML Render Form" to reload a form.

It works great for one submission, however if you submit forms subsequently (submit it twice or more without hard-refreshing the page) it will display 2 or more messages one after another. Plus after I added Google NoCaptcha, I found out that it doesn't reload properly after one submission (I have AJAX submit=YES set) - it just displays the label I set for it:

Please tick the box above or enter correct code to proceed


It does not display main Google NoCaptcha element.

I have tried what you suggested:


You could change you code to

Code:
<?php
$form->data = array('show_message' => true);
?>
and then use an Event Loop plus a Custom Code element in the designer tab to show the message:

Code:
<?php
if ( isset($form->data['show_message']) && $form->data['show_message'] ) {
echo "<div>Put your message here</div>";
?>
Then the message will only show on a reload.


but I can't make it work at all. The form reloads, but no message is displayed plus Google NoCaptcha doesn't reload.

Maybe I have done it incorrectly. By the way I use SH404SEF on my website.

The full form:

On Load

1) Load Google NoCaptcha
2) HTML Render Form (AJAX submit=YES, Form method=POST, Relative URL=NO)

On Submit

1) Check Google No Captcha

a) On Success
b) On Fail

Event Loop

2) Custom code (for email)


<?php
$form->data['name'] = "{$form->data['FirstN']} {$form->data['LastN']}";
?>


3) Email (won't go into details - it works fine)

4) Custom Code


<?php
$form->data = array('show_message' => true);
?>


5) Event Loop

6) Custom Code


<?php
if ( isset($form->data['show_message']) && $form->data['show_message'] ) {
echo "<div>Put your message here</div>";
?>


I'm ready to give up on this approach and don't reload a form after submission - just display a message with "scroll to top" function for which I will create new post.

Is what I would like to do doable?

Thanks.
GreyHead 63.4
March 05 2015 #343679
Hi tomaszciti,

Please try turning Ajax submit off. I think that will solve most of these problems.

Bob
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much
T
tomaszciti 4
March 05 2015 #343691
Hi

I'd like to use AJAX as I put form inside article using Chronoform plugin. Plus I have SH404SEF running.

I have tried to turn AJAX submit off though. Google NoCaptcha is reloaded properly, but it still doesn't display Thank You message. Google NoCaptcha might be reloaded, because the whole form is reloaded - URL changes to my.comain.com/component/com_chronoforms5/?chronoform=update-details&event=submit

from

my.domain.com/update-details

Thanks.