Buy Now
Sign in


rtobias , April 25 2017, 17:20
rtobias 53
April 25 2017, 17:20 #367422
Before I get into the details of my situation, let me just clearly ask: Is there a way to put a delay in an action in the setup tab? This would allow us to to specify some time interval to wait before the next action is processed.

For example, I have a Read Database action. I am looking up if an email address already exists in a table (this is a registration form). If found, I display a message stating, "This email address is already registered". I would then like to have a delay action, so I can give someone maybe 10 seconds to read that message, and then process the next action, which would be an Event loader (to reload the Load event). I could then on fail, proceed to process the rest of my form, but if I have the event switcher in the On Success, then it doesn't really matter; I can keep the rest of my actions just coming directly after the Read Database (makes it a little easier to manage, but at least in CF6, it is now extremely easy to move things around if that is just the better approach). Currently I have the Email address found message, followed by my Registration Complete Message.

I think a delay action would be useful, but I could understand if in this case, I just need to change my logic and move the rest of my form into the On Fail case of my Read Database event. My On Load event renders the form, though, and I think the On Submit event fires after the page is navigated away from (my button is type: Submit), so I think I do have to re-render the form again.
GreyHead 64
April 25 2017, 17:40 #367424
Hi Randy,

There is some code in this FAQ which will let you show a message for a fixed period and then redirect. Does this do what you need?

ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much
rtobias 53
April 25 2017, 17:51 #367426
Assuming 5 in content="5;url..." is the delay, yes, that would work in this case. This is because the event that I would need to load is the On Load, so the beginning of my form. I suppose with careful url params, this method could also be used on multipage forms if there was an issue later on. The problem with that, though, is that I suspect you would lose the data already filled out on a prior page. That could probably be handled with session handling. More to the point, a logic rethink might be in order at that point to use validation via AJAX.

I guess at the end of the day, yes, it looks like this should work for me, and it really isn't worthwhile to try to guess the future needs. That said, if it isn't difficult, I still think a Delay action would fit very nicely in the Logic section (very much liking the new organization in CF6. I have been doing a lot less guessing of where things might be). You did make my think, though, I could probably always use a php action and sleep(5) if I wanted to wait 5 seconds.

Thanks Bob; I keep forgetting that I can always add in php to supplement the pre-built actions.