Since it takes a very long time to save a complex form I try to put the php code in an external file.
I can use the form-> data in the external php file , but it does not save the changes made in this file in the form->data
Any suggestion how to use the changed array in the form?
Rob
This is the code I use to acess the external function:
This is the file:
I can use the form-> data in the external php file , but it does not save the changes made in this file in the form->data
Any suggestion how to use the changed array in the form?
Rob
This is the code I use to acess the external function:
<?php
echo \GCore\ergonomie\php\databases:klacht($form->data[klacht], $form->data[klacht2],$form->data[klachten]);
?>
This is the file:
defined('_JEXEC') or die('Restricted access');
defined("GCORE_SITE") or die;
class databases extends \GCore\Libs\Helper{
public static function databases_klacht($klacht,$klacht2,$klachten){
date_default_timezone_set('Europe/Amsterdam');
$datum = date('d-m-Y');
foreach ($klacht2 as $v2) {
$sleutel= key($klacht2);
foreach ($klacht as $v3) {
if ($klacht[klacht_code] == $sleutel){
$klacht[datum]= $datum;
$klacht[klacht]= $v2;
}
else
{
$gegevens['klachten_id'] = $klachten['id'];
$gegevens['datum'] = $datum;
$gegevens['klacht_code'] = $sleutel;
$gegevens['klacht'] = $v2;
array_push($klacht, $gegevens);
}
next ($klacht2;
}
}
}
}
?>
Hi RobP,
Please see this FAQ. Including the file into a Custom Code action or element makes the $form->data array and the Joomla! and GECore libraries available.
Bob
Please see this FAQ. Including the file into a Custom Code action or element makes the $form->data array and the Joomla! and GECore libraries available.
Bob
Hi Bob,
Thanks for for quick responce!
The $form->form['Form']['title'] part is a bit confusing.
Is it possible to give me an example what the syntax should be if my form name is "klachten" and the file to be included is "/components/com_chronoforms5/includes/includes.php"
Rob
Thanks for for quick responce!
The $form->form['Form']['title'] part is a bit confusing.
Is it possible to give me an example what the syntax should be if my form name is "klachten" and the file to be included is "/components/com_chronoforms5/includes/includes.php"
Rob
Hi RobP,
The $form->form['Form']['title'] will be replaced by the name of the current form. I keep a separate folder for each form to avoid problems with duplicated file names.
To use your example exactly
Bob
The $form->form['Form']['title'] will be replaced by the name of the current form. I keep a separate folder for each form to avoid problems with duplicated file names.
To use your example exactly
<?php
include(JPATH_SITE.'/components/com_chronoforms5/includes/includes.php');
?>
Bob
Hi Bob,
I just looked at the Form->form array.
Now I understand why a large for is so slow to load!
It makes sense to use load everything in an Object if you have a lot of small forms.
For one or two very large forms it is to much overhead.
Fabrik may be better for large forms.
Rob
I just looked at the Form->form array.
Now I understand why a large for is so slow to load!
It makes sense to use load everything in an Object if you have a lot of small forms.
For one or two very large forms it is to much overhead.
Fabrik may be better for large forms.
Rob
Hi Rob,
The admin forms for a large ChronoForm can get very large - but I have rarely had any major problems with them loading. The size is related to the number of variables that CF offers for each element and action.
Bob
The admin forms for a large ChronoForm can get very large - but I have rarely had any major problems with them loading. The size is related to the number of variables that CF offers for each element and action.
Bob
Hi Bob,
Not just the admin forms.
The frond-end form has already over 500 sub arrays in the form->form array, some are very large and I am just starting.
At the moment it takes 10 seconds to load.
I will try to put more in external files, I don't use chronoform elements in my forms.
Rob
Not just the admin forms.
The frond-end form has already over 500 sub arrays in the form->form array, some are very large and I am just starting.
At the moment it takes 10 seconds to load.
I will try to put more in external files, I don't use chronoform elements in my forms.
Rob
This topic is locked and no more replies can be posted.