Hi,
I need help with two problems:
1 - Submit event doesn't work:
I have a multipage form with DBRead and DBSave:
http://sioa-aprocor.joaquinduro.es/index.php?option=com_chronoforms5&chronoform=RegistrarLlamada
The form proccess is:
1-Check if email address exists on DB:
1.1- If exists, it display form page 2 with the values received from DB Read.
1.2- If not exits, it display form page 2 with empty values to fill in the fields.
When you finish, you must click on "Guardar" button to save records on database but it is not working.
2 - When the form found the email, it doesn't set the dropdown values correctly.
Please, can you take a look. You can test with email test@test.es that exists on database.
Thanks. Regards,
Joaquín
I need help with two problems:
1 - Submit event doesn't work:
I have a multipage form with DBRead and DBSave:
http://sioa-aprocor.joaquinduro.es/index.php?option=com_chronoforms5&chronoform=RegistrarLlamada
The form proccess is:
1-Check if email address exists on DB:
1.1- If exists, it display form page 2 with the values received from DB Read.
1.2- If not exits, it display form page 2 with empty values to fill in the fields.
When you finish, you must click on "Guardar" button to save records on database but it is not working.
2 - When the form found the email, it doesn't set the dropdown values correctly.
Please, can you take a look. You can test with email test@test.es that exists on database.
Thanks. Regards,
Joaquín
Hi Joaquín,
When you re-load the record you can see that the values for the drop-downs are in the sub-array,, not in the main $form->data[''] array. I'm not clear how the other data is being re-loaded. Is there a Multi-Page action in use here?
Removing any Model ID in the DB Read should make the data available and re-load the drop-downs.
You also need to add the record id as a hidden input after the second page - because that is not there the final DB Save is creating a new record instead of updating the existing one.
Bob
When you re-load the record you can see that the values for the drop-downs are in the sub-array,, not in the main $form->data[''] array. I'm not clear how the other data is being re-loaded. Is there a Multi-Page action in use here?
Removing any Model ID in the DB Read should make the data available and re-load the drop-downs.
You also need to add the record id as a hidden input after the second page - because that is not there the final DB Save is creating a new record instead of updating the existing one.
Bob
Hi Bob,
It works but when I update the values of last two fields (mConocer and motivo that are above "Guardar" button on second page), the system execute this SQL instruction without updating motivoConocer and otro columns of database table (on DB Read it reads the values from this columns correctly):
Thanks Bob
It works but when I update the values of last two fields (mConocer and motivo that are above "Guardar" button on second page), the system execute this SQL instruction without updating motivoConocer and otro columns of database table (on DB Read it reads the values from this columns correctly):
Array
(
[28] => Array
(
[DB Save] => Array
(
[Queries] => Array
(
[0] => UPDATE `z2ma5_sioa_demandante` AS `Data` SET `nombre` = 'Joaquin', `apellidos` = 'Duro', `telefono1` = '123456', `telefono2` = '654321', `mail` = 'test@test.es', `relacion` = '1' WHERE `Data`.`mail` = 'test@test.es';
)
)
)
)
Thanks Bob
Hi Joaquín,
Please post the whole of the Debugger output so that I can see what values are there now.
If you changed the columns in the table recently please Click the Delete Cache icon in the Forms Manager toolbar to update ChronoForms' records.
Bob
Please post the whole of the Debugger output so that I can see what values are there now.
If you changed the columns in the table recently please Click the Delete Cache icon in the Forms Manager toolbar to update ChronoForms' records.
Bob
Hi Bob,
Whole Debugger output:
Also, my form on first page checks that an email exists or not:
if exists
i want to update the database record with DB Save wirting this condition on update conditions (will return empty because that mail doesn't exists on database:
if not exits
i want to make an insert with the fields filled in by the user.
Thanks again for your help,
Joaquín
?>
Whole Debugger output:
Data Array
Array
(
[chronoform] => RegistrarLlamada
[event] => submit
[email] => joaquinduro@joaquinduro.es
[button3] => Buscar
[option] => com_chronoforms5
[idDemandante] => 3
[nombre] => Pepe
[apellidos] => Perez
[telefono1] => 123456
[telefono2] => 676505364
[mail] => joaquinduro@joaquinduro.es
[relacion] => 2
[mConocer] => 4
[motivo] => Prueba
[enviarD] => Guardar
[id] => 0
)
Array
(
)
Errors
Array
(
)
Debug Info
Array
(
[28] => Array
(
[DB Save] => Array
(
[Queries] => Array
(
[0] => UPDATE `z2ma5_sioa_demandante` AS `Data` SET `nombre` = 'Pepe', `apellidos` = 'Perez', `telefono1` = '123456', `telefono2` = '676505364', `mail` = 'joaquinduro@joaquinduro.es', `relacion` = '2' WHERE `Data`.`mail` = 'joaquinduro@joaquinduro.es';
)
)
)
)
Also, my form on first page checks that an email exists or not:
if exists
i want to update the database record with DB Save wirting this condition on update conditions (will return empty because that mail doesn't exists on database:
<?php
return array("mail" => $form->data["mail"]);
if not exits
i want to make an insert with the fields filled in by the user.
Thanks again for your help,
Joaquín
?>
Hi Joaquín,
That all looks good - I can see no reason why the relacion and mConocer columns aren't being updated - provided that the columns are in the database and the ChronoForms cache has been cleared.
ChronoForms uses the Joomla! method to switch between UPDATE and INSERT. If there is a valid record ID in the data it updates, otherwise it inserts. So when you check for the email you should get the record ID and add it to the data in a hidden input, Then you can remove the Condition from the DB Save action as the ID will do it for you,
Bob
That all looks good - I can see no reason why the relacion and mConocer columns aren't being updated - provided that the columns are in the database and the ChronoForms cache has been cleared.
ChronoForms uses the Joomla! method to switch between UPDATE and INSERT. If there is a valid record ID in the data it updates, otherwise it inserts. So when you check for the email you should get the record ID and add it to the data in a hidden input, Then you can remove the Condition from the DB Save action as the ID will do it for you,
Bob
Thanks Bob,
it works now!
The problem was I had a hidden field called idDemandante instead id.
The database save can skip mConocer and motivo fields because they are part of a multifield field?
Thanks again,
Joaquín
it works now!
The problem was I had a hidden field called idDemandante instead id.
The database save can skip mConocer and motivo fields because they are part of a multifield field?
Thanks again,
Joaquín
Hi Joaquin,
It shouldn't skip them as they are valid entries in the $form->data array. By all means PM me the site URL, the form name, and a SuperAdmin login and I'll take a quick look.
Bob
It shouldn't skip them as they are valid entries in the $form->data array. By all means PM me the site URL, the form name, and a SuperAdmin login and I'll take a quick look.
Bob
Hi Joaquin,
The data isn't saving because there are no 'mConocer' or 'motivo' columns in the #__sioa_demandante database table, there is just one called 'motivoConocer'
Bob
The data isn't saving because there are no 'mConocer' or 'motivo' columns in the #__sioa_demandante database table, there is just one called 'motivoConocer'
Bob
So, one question:
The field id must have the same name as database table column??
Thanks Bob
The field id must have the same name as database table column??
Thanks Bob
This topic is locked and no more replies can be posted.