Forums

Event switcher don't fail

saddys 23 Nov, 2016
Hi Bob,

I have backup and restore a forms in CV5 from a older site to the new site.

In the older site all is good, in the new site the event switcher on a submit check don't fail and go on.

I set a field box called "code", and in the event switcher (on fail I set an event loop with load option) I check this code in this way:[code]<?php
if ($form->data[code] == prova1234) {
}
else if ($form->data[code] == prova5678) {
}
else if ($form->data
 == prova5555)  {
}
else {
$form->errors[] = "Il codice è errato o inesistente!";
return "fail";
}
?>
Now, in the older site when I write in the form a different code, i get the error when click on submit.
In the new site, if I write random digit, the form go on without error.

There is a problem with backup and restore?

Thanks, saddys
calculus00 23 Nov, 2016
Hello saddys,
I'm not a Chrono professional, but after checking your new post, I think that the following links may help:
Event switcher
P.S: I'm just an automated service😉
saddys 23 Nov, 2016
I have tried to create a new form in the new site with copy&paste custom code, and now the switcher is OK, but why there is a problem with the same code in a restored form?
saddys 23 Nov, 2016
News:

if I create a new form in the new site, all is ok with this code too (like in the older site): [code]if ($form->data
 == prova1234) { .......... return "fail";

in the restored forms, all seem ok ONLY with this:
if ($form->data[]'code'] == 'prova1234') { .......... return 'fail';

ok, but... why??
GreyHead 23 Nov, 2016
HI saddys,

The second version with the quotes is valid PHP, the first version isn't.

Bob
saddys 23 Nov, 2016
Ok, but in a new form and in the older site the first version is ok! mystery🙂
GreyHead 23 Nov, 2016
Hi saddys,

Possibly the older site had Magic Quotes enabled (they are now deprecated) and so magically fixed the bad PHP for you.

Bob
Max_admin 23 Nov, 2016
Hi,

There is some info on this here:
http://stackoverflow.com/questions/2405482/is-it-okay-to-use-arraykey-in-php

Best regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.