I have a form for conference registration which I made by a deep rebuild of the contact form.
The problem: the red error popups work well and always, while the green success pop-up shows up at random. Or rather, it seems to never show up if registration goes smoothly (with no errors) on the first try. Everything else works, and if there where errors - the next attempt does show the green pop-up.
The internal works in terms of function call structure is the same exact as in contact.php. Also, funnily enough, I think the original contact form also does this bug - I do not explicitly remember testing it though. I likely did?
Thus: what controls the pop-up? I do smarty->assign('success', 1) on success, and that does not work. Or rather, it does not work first time. I cannot pinpoint it by analysing the code, so - HALP.
Thank you
Green pop-up notification for success is random
-
- Posts: 4
- Joined: Tue Dec 10, 2024 12:28 pm
- fraenkiman
- Posts: 308
- Joined: Thu Feb 03, 2022 7:25 pm
- Location: Berlin, Germany
- Contact:
Re: Green pop-up notification for success is random
Hello andriishyichuk,
the contact form in its original form up to FlatPress 1.3.1 also has the problem that green success messages are not displayed. I have fixed this in FlatPress 1.4 CR1.
This error is particularly noticeable when caching mechanisms are active on the web server, for example APCu or OPcache.
Here you can find the changes that have fixed the problem.
Best regards
Frank
the contact form in its original form up to FlatPress 1.3.1 also has the problem that green success messages are not displayed. I have fixed this in FlatPress 1.4 CR1.
This error is particularly noticeable when caching mechanisms are active on the web server, for example APCu or OPcache.
Here you can find the changes that have fixed the problem.
Best regards
Frank
My
-
- Posts: 4
- Joined: Tue Dec 10, 2024 12:28 pm
Re: Green pop-up notification for success is random
I see, thank you.
Do I understand correctly that doing "$smarty->assign('success', 1);" and then 'system_seterr("contact", 1)' should do the trick? That's what I did and it's still random.
Which part of the code reads the variable set by '"system_seterr("contact", 1)'? Cuz, I named my form "regform" and hence the seterr part would read "system_seterr("regform", 1). Basically, is there a static lust of err variables that I must update?
Do I understand correctly that doing "$smarty->assign('success', 1);" and then 'system_seterr("contact", 1)' should do the trick? That's what I did and it's still random.
Which part of the code reads the variable set by '"system_seterr("contact", 1)'? Cuz, I named my form "regform" and hence the seterr part would read "system_seterr("regform", 1). Basically, is there a static lust of err variables that I must update?
- fraenkiman
- Posts: 308
- Joined: Thu Feb 03, 2022 7:25 pm
- Location: Berlin, Germany
- Contact:
Re: Green pop-up notification for success is random
Hello andriishyichuk.
The logic fits.
$success must result in 1. Then you assign the result 1 directly to the template and then with system_seterr into the session -> before a forwarding takes place.
Before you assign a result to the template, simply check one line above whether $success = utils_mail.... really returns 1. The success message depends on this. It is possible that sendmail or a similar program is acting up.
If you get stuck, throw everything into a ZIP archive and send it to me by e-mail.
Best regards
Frank
The logic fits.
$success must result in 1. Then you assign the result 1 directly to the template and then with system_seterr into the session -> before a forwarding takes place.
Before you assign a result to the template, simply check one line above whether $success = utils_mail.... really returns 1. The success message depends on this. It is possible that sendmail or a similar program is acting up.
Code: Select all
$success = utils_mail....; // must return 1
echo '<pre>' . $success . '</pre>';
$smarty->assign('success', $success ? 1 : -1);
system_seterr('xyz', $success ? 1 : -1);
utils_redirect.....;
Best regards
Frank
My
-
- Posts: 4
- Joined: Tue Dec 10, 2024 12:28 pm
Re: Green pop-up notification for success is random
Last time I did it, I just went with $smarty->assign('success', 1);
And yet it was random.
Anyway, today is the day I add another feature, and I will know more.
And yet it was random.
Anyway, today is the day I add another feature, and I will know more.
Who is online
Users browsing this forum: Ahrefs [Bot] and 1 guest