Forums

include in "on submit" doesn't work

webcrea 13 Apr, 2016
Hi,

in a "custom code" in the "on submit"

<?php include('libraries/cegcore/my-dir/my-script.php'); ?>

generates warnings or error and doesn't load the php file

but in "on load" that's work well

do you have idea?
GreyHead 13 Apr, 2016
Hi Christophe,

You probably need to use a full URL, try adding a / at the beginning. Also see this FAQ https://www.chronoengine.com/faqs/58-cfv4/cfv4-elements-and-html/4376-how-can-i-include-files-or-code-in-a-chronoform.html

Bob
webcrea 13 Apr, 2016
Hi Bob and thanks to help me,
Le traitement se fait bien et très vite, en 1 seconde, puis page blanche!
Aucun echo dans mon code
webcrea 13 Apr, 2016
C'est tout de même super étrange le fonctionnement de chronoform, parfois ça marche parfois ça bug sans qu'on sache pourquoi.

Lorsque j'inclue une fonction que cela soit en direct dans le code ou via un include et bein ça fait le traitement et tu sais pas pourquoi il part en vrille et t'affiche une page blanche. il est Cheulou ce composant
webcrea 13 Apr, 2016

This is private content

GreyHead 14 Apr, 2016
Hi Chris,

I don't see any obvious errors but there could easily be a misplaced quote. If you temporarily set your site Error Reporting to Maximum then you should see a PHP error message that will help the diagnosis.

Bob
webcrea 14 Apr, 2016
I tried : nothing, it's like the content send to the template bug all; Like an exit in the code.

with in
error_reporting(E_ALL);
ini_set("display_errors", 1);
nothing

If i delete my php, it's ok, the message appears,

thanks Bob
webcrea 14 Apr, 2016
I find something, chronoform doesn't like NOTICE and WARNING and crashes

for example
$form->data[toto] = "something"; produce a warning the var doesn't exist and cc crashes

if($n)... $n never defined produce a notice and cc crashes

now, with the log error file, i reduced all the warning and notice

always crash with nothing in the log error file, it's very difficult to work efficiency with chronoform
webcrea 14 Apr, 2016
in fact chronoform doesn't like this in custom code in on submit

<?php
function myfct(){

}
?>

how can we do to use a function ?
GreyHead 14 Apr, 2016
Hi Christophe,

I have included all kinds of PHP in Custom Code actions in the On Load and On Submit events with no problems. I'm travelling this week and can't test on my iPad, I can double-check when I'm back at my desk next week.

Bob
webcrea 14 Apr, 2016
Don't worry Bob,
I restart from scratch form and for the moment, it's well...
Thanks for your help
Good trip
This topic is locked and no more replies can be posted.