I have a problem with my form. At each validation, he created 2 record : the first with the entered data, and the second, empty.
My form is very simple: few input text, select and checkbox (no file).
In onLoad event: i made a custom code :
<?php
$user = \JFactory::getUser();
$form->data['name'] = $user->name;
$form->data['user_id'] = $user->id;
?>
And after the html render form.
On submit event, i do :
1) custom code:
<?php
echo '<pre>';
print_r($form->data);
echo '</pre>';
?>
2) debugger
3) DB save
Enabled: yes
Table: mytable (ok)
save under model id: no
multi: no
model id: data
force save : no
4)Email
To send an email
5)custom code
to display a static message
After the action: i have
Array
(
[chronoform] => contact-interne-FR
[event] => submit
[first_name] => Del Ray
[last_name] => Camillia
[client] => Client
[societe] => Tenebreuse
[pays] => EU
[email] => hugo.schuler@dag-system.com
[phone] => 0625457845
[sujet] => information
[plateforme] => event
[service] => webmaster@dag-system.com
[message] => sqdsqdqsdsqdqsd
[submit6] => Transmettre
[user_id] =>
[name] =>
)
Data Array
Array
(
[chronoform] => contact-FR
[event] => submit
[first_name] => Del Ray
[last_name] => Camillia
[client] => Client
[societe] => Tenebreuse
[pays] => EU
[email] => moi@blzablz.com
[phone] => 0625457845
[sujet] => information
[plateforme] => event
[service] => webmaster@blzablz.com
[message] => sqdsqdqsdsqdqsd
[submit6] => Transmettre
[user_id] =>
[name] =>
)
Array
(
)
Errors
Array
(
)
Debug Info
Array
(
)
Le rapport est enregistré et transmis au service concerné.
Two questions:
- the user_id and name (hidden fields) is empty but the data were saved in mysql.
- why if i do print_r($form->data) , i have a single record and in debug frame i have two; like in mysql. I don't understand why a empty record was created.
Any idea?
Please check that the Custom Code for the User info is *before* the HTML (Render form) action - if it is afterwards that would explain why the data isn't included. (Note: you could probably do this in the On Submit event instead)
I'm not sure about the two saves - but I notice that there are two different values in the submitted data
[chronoform] => contact-FR
[chronoform] => contact-interne-FR
Are these two different forms - are they somehow connected?
The Debugger includes the $form->data values so you don't normally need the echo statement as well. Moving the Debugger to the end of the On Submit event (or adding a second one) should show you the MySQL query/queries being created.
Bob
I updated my form.
On load event:
1) load css
2) render form
On submit event:
1) custom code : to save user_id and name (same code than before on load event) and :
<?php
$form->data['subject'] = "Rapport de contact #{$form->data['id']}: {$form->data['sujet']} {$form->data['plateforme']} - {$form->data['first_name']} {$form->data['client']}";
$form->data['message'] = nl2br($form->data['message']);
?>
2) DB save
3) email (send 1 mail ok with the new record id created to the correct mail address)
4) custom code (display message "everything ok")
And now ... the result:
Le rapport de contact est enregistré et transmis au service concerné.
Data Array
Array
(
[chronoform] => contact-interne-FR
[event] => submit
[first_name] => Del Ray
[last_name] => Camillia
[societe] => Tenebreuse
[pays] =>
[email] =>
[phone] =>
[sujet] => information
[plateforme] => All
[service] => webmaster@societe.com
[message] => another test
[submit6] => Transmettre
[user_id] => 281
[name] =>Me
[id] => 941
[subject] => Rapport de contact #941: information All - Del Ray
[ip_address] => 88.172.179.2
)
Array
(
)
Errors
Array
(
)
Debug Info
Array
(
[12] => Array
(
[DB Save] => Array
(
[Queries] => Array
(
[0] => INSERT INTO `fvwzy_chronoengine_chronoforms_datatable_contact-interne-fr` (`first_name`, `last_name`, `societe`, `pays`, `email`, `phone`, `sujet`, `plateforme`, `service`, `message`, `user_id`, `uniq_id`, `created`) values ('Del Ray', 'Camillia', 'Tenebreuse', '', '', '', 'information', 'All', 'webmaster@societe.com', 'another test', '281', 'd772f4bc75c6354426b195c41d4eccf674886ad2', '2016-09-01 11:24:41');
)
)
)
[13] => Array
(
[Email] => Array
(
[0] => An email with the details below was sent successfully:
[1] => To:webmaster@societe.com
[2] => Subject:Rapport de contact #941: information All - Del Ray
[3] => From name:DAG System
[4] => From email:noreply@societe.com
[5] => CC:
[6] => BCC:
[7] => Reply name:
[8] => Reply email:
[9] => Attachments:
[10] => Array
(
)
[11] => Body:
<div class="gform-all">
<p> </p>
<p>Rapport de contact #941: information All - Del Ray </p>
<p> <i>Fait par Moi le 01/09/2016 à 11:24:41</i></p>
<br/>
<table>
<tbody>
<tr>
<td>
<strong><label class="gform-label-left" for="sujet">Sujet :</label></strong> information All
</td>
<td><p> </p></td>
</tr>
<tr>
<td colspan="2"><p> </p></td>
</tr>
<tr>
<td>
<strong><label class="gform-label-left" for="client">Client :</label></strong>
</td>
<td><p> </p></td>
</tr>
<tr>
<td colspan="2"><p> </p></td>
</tr>
<tr>
<td>
<strong><label class="gform-label-left" for="first_name">Name :</label></strong> Del Ray Camillia
</td>
<td><p> </p></td>
</tr>
<tr>
<td colspan="2"><p> </p></td>
</tr>
<tr>
<td>
<strong><label class="gform-label-left" for="societe">Structure :</label></strong> Tenebreuse
</td>
<td><p> </p></td>
</tr>
<tr>
<td colspan="2"><p> </p></td>
</tr>
<tr>
<td>
<strong><label class="gform-label-left" for="email">Email :</label></strong>
</td>
<td><p> </p></td>
</tr>
<tr>
<td colspan="2"><p> </p></td>
</tr>
<tr>
<td>
<strong><label class="gform-label-left" for="phone">Phone :</label></strong>
</td>
<td><p> </p></td>
</tr>
<tr>
<td colspan="2"><p> </p></td>
</tr>
<tr>
<td>
<strong><label class="gform-label-left" for="pays">Country :</label></strong>
</td>
<td><p> </p></td>
</tr>
<tr>
<td colspan="2"><p> </p></td>
</tr>
<tr>
<td>
<strong><label class="gform-label-left" for="message">Message :</label></strong><br/>
another test
</td>
<td><p> </p></td>
</tr>
</tbody>
</table>
</div>
<br /><br />IP: my ip address
)
)
)
I don't understand : 2 data array; 1 insert; but 2 records on the database (1 correct and 1 empty).
The most likely explanation is that somehow the form is being submitted twice. You could try using the Submit Limit action to block a second immediate submission. What happens after the form submits? Doe sit re-load the same page?
Bob
I try using a submit limit to 60 secondes.
The steps in submit event are:
- db save
- display message
- debugger
- submit limit
Dosen't reload the same page.
Otherwise, i try insert with sql query direct: no problem.
The Submit Limit action needs to be the first action in the On Submit event and it needs to have a ReDirect action (or something like that) in the pink On Fail event
Bob.
this is a moment that I seek; so I decided to repeat the form.
I created a form : contact-interne-v2-FR, with no dbsave action (with a new table I have the same problem).
You can look the files join for looking my design and setup (more simple than before).
I tryed to add content = article (table content) => no problem.
The debug info for my new form:
Data Array
Array
(
[chronoform] => contact-interne-v2-FR
[event] => submit
[first_name] => carmine
[last_name] => eon
[societe] =>
[pays] =>
[email] =>
[phone] =>
[sujet] => information
[plateforme] => All
[service] => blabla@mysite.com
[message] => retourt
[submit6] => Transmettre
)
Array
(// THE PROBLEM I THINK !!
)
Errors
Array
(
)
Debug Info
Array
(
)
The table structure:
look table structure file
The data examples:
look table data file
The submit limit action is on 20 seconds with a message if fail. it never appears.
In html render form:
page = 1
submit event = submit ("transmettre" button type is submit)
form method = post
action url =
form class = chronoform
tag attachement =
sign required label = yes
relative url= yes
ajax = no
form tags = yes
xhtml = no
why???
this is a moment that I seek; so I decided to repeat the form.
I created a form : contact-interne-v2-FR, with no dbsave action (with a new table I have the same problem).
You can look the files join for looking my design and setup (more simple than before).
I tryed to add content = article (table content) => no problem.
The debug info for my new form:
Data Array
Array
(
[chronoform] => contact-interne-v2-FR
[event] => submit
[first_name] => carmine
[last_name] => eon
[societe] =>
[pays] =>
[email] =>
[phone] =>
[sujet] => information
[plateforme] => All
[service] => blabla@mysite.com
[message] => retourt
[submit6] => Transmettre
)
Array
(// THE PROBLEM I THINK !!
)
Errors
Array
(
)
Debug Info
Array
(
)
The table structure:
id int 11 0 0 -1 0 0 0 0 -1 0
uniq_id varchar 50 0 0 0 0 0 0 0 utf8 utf8_general_ci 0 0
user_id int 11 0 0 0 0 0 0 0 0 0
created datetime 0 0 0 0 0 0 0 0000-00-00 00:00:00 0 0 0
modified datetime 0 0 -1 0 0 0 0 0 0 0
first_name varchar 255 0 0 0 0 0 0 0 utf8 utf8_general_ci 0 0
last_name varchar 255 0 0 0 0 0 0 0 utf8 utf8_general_ci 0 0
client varchar 255 0 0 0 0 0 0 0 utf8 utf8_general_ci 0 0
societe varchar 255 0 0 0 0 0 0 0 utf8 utf8_general_ci 0 0
pays varchar 255 0 0 0 0 0 0 0 utf8 utf8_general_ci 0 0
email varchar 255 0 0 0 0 0 0 0 utf8 utf8_general_ci 0 0
phone varchar 255 0 0 0 0 0 0 0 utf8 utf8_general_ci 0 0
sujet varchar 255 0 0 0 0 0 0 0 utf8 utf8_general_ci 0 0
plateforme varchar 255 0 0 0 0 0 0 0 utf8 utf8_general_ci 0 0
service varchar 255 0 0 0 0 0 0 0 utf8 utf8_general_ci 0 0
message varchar 255 0 0 0 0 0 0 0 utf8 utf8_general_ci 0 0
The data examples:
1 029a8af4ce9129b0a0b2f5a6023eaf5521fa584e 281 2016-10-11 11:47:04 Letest Ceslui company EU car@lol.fr information All webmaster@mysite.com blabla
11 dc99130a8ffbe98007767244cc24708976f26608 281 2016-10-11 11:47:07
21 0bf2713c29a227467d55be5366f6ddecb031667c 281 2016-10-11 11:51:57 lebeta test info@stego.fr information All deb@mysite.com qsdfdfsdfsd
31 613ab088ad1046dc06b4f057d0bd7ba97b368c0f 281 2016-10-11 11:51:59
41 5cfe01ed5d3791a1dbba30c0a1f64dd3f6460027 281 2016-10-11 11:59:25 cgff fffgffg information All doubt@mysite.com ffgfgfg
51 988674616dce2f7bacc3f9de6db2c437fed27f8c 281 2016-10-11 11:59:28
The submit limit action is on 20 seconds with a message if fail. it never appears.
In html render form:
page = 1
submit event = submit ("transmettre" button type is submit)
form method = post
action url =
form class = chronoform
tag attachement =
sign required label = yes
relative url= yes
ajax = no
form tags = yes
xhtml = no
why???
this is a moment that I seek; so I decided to repeat the form.
I created a form : contact-interne-v2-FR, with no dbsave action (with a new table I have the same problem).
You can look the files join for looking my design and setup (more simple than before).
I tryed to add content = article (table content) => no problem.
The debug info for my new form:
Data Array
Array
(
[chronoform] => contact-interne-v2-FR
[event] => submit
[first_name] => carmine
[last_name] => eon
[societe] =>
[pays] =>
[email] =>
[phone] =>
[sujet] => information
[plateforme] => All
[service] => blabla@mysite.com
[message] => retourt
[submit6] => Transmettre
)
Array
(// THE PROBLEM I THINK !!
)
Errors
Array
(
)
Debug Info
Array
(
)
The table structure:
id int 11 0 0 -1 0 0 0 0 -1 0
uniq_id varchar 50 0 0 0 0 0 0 0 utf8 utf8_general_ci 0 0
user_id int 11 0 0 0 0 0 0 0 0 0
created datetime 0 0 0 0 0 0 0 0000-00-00 00:00:00 0 0 0
modified datetime 0 0 -1 0 0 0 0 0 0 0
first_name varchar 255 0 0 0 0 0 0 0 utf8 utf8_general_ci 0 0
last_name varchar 255 0 0 0 0 0 0 0 utf8 utf8_general_ci 0 0
client varchar 255 0 0 0 0 0 0 0 utf8 utf8_general_ci 0 0
societe varchar 255 0 0 0 0 0 0 0 utf8 utf8_general_ci 0 0
pays varchar 255 0 0 0 0 0 0 0 utf8 utf8_general_ci 0 0
email varchar 255 0 0 0 0 0 0 0 utf8 utf8_general_ci 0 0
phone varchar 255 0 0 0 0 0 0 0 utf8 utf8_general_ci 0 0
sujet varchar 255 0 0 0 0 0 0 0 utf8 utf8_general_ci 0 0
plateforme varchar 255 0 0 0 0 0 0 0 utf8 utf8_general_ci 0 0
service varchar 255 0 0 0 0 0 0 0 utf8 utf8_general_ci 0 0
message varchar 255 0 0 0 0 0 0 0 utf8 utf8_general_ci 0 0
The data examples:
1 029a8af4ce9129b0a0b2f5a6023eaf5521fa584e 281 2016-10-11 11:47:04 Letest Ceslui company EU car@lol.fr information All webmaster@mysite.com blabla
11 dc99130a8ffbe98007767244cc24708976f26608 281 2016-10-11 11:47:07
21 0bf2713c29a227467d55be5366f6ddecb031667c 281 2016-10-11 11:51:57 lebeta test info@stego.fr information All deb@mysite.com qsdfdfsdfsd
31 613ab088ad1046dc06b4f057d0bd7ba97b368c0f 281 2016-10-11 11:51:59
41 5cfe01ed5d3791a1dbba30c0a1f64dd3f6460027 281 2016-10-11 11:59:25 cgff fffgffg information All doubt@mysite.com ffgfgfg
51 988674616dce2f7bacc3f9de6db2c437fed27f8c 281 2016-10-11 11:59:28
The submit limit action is on 20 seconds with a message if fail. it never appears.
In html render form:
page = 1
submit event = submit ("transmettre" button type is submit)
form method = post
action url =
form class = chronoform
tag attachement =
sign required label = yes
relative url= yes
ajax = no
form tags = yes
xhtml = no
why???
this is a moment that I seek; so I decided to repeat the form.
I created a form : contact-interne-v2-FR, with no dbsave action (with a new table I have the same problem).
You can look the files join for looking my design and setup (more simple than before).
I tryed to add content = article (table content) => no problem.
The debug info for my new form:
Data Array
Array
(
[chronoform] => contact-interne-v2-FR
[event] => submit
[first_name] => carmine
[last_name] => eon
[societe] =>
[pays] =>
[email] =>
[phone] =>
[sujet] => information
[plateforme] => All
[service] => blabla@mysite.com
[message] => retourt
[submit6] => Transmettre
)
Array
(// THE PROBLEM I THINK !!
)
Errors
Array
(
)
Debug Info
Array
(
)
The table structure:
id int 11 0 0 -1 0 0 0 0 -1 0
uniq_id varchar 50 0 0 0 0 0 0 0 utf8 utf8_general_ci 0 0
user_id int 11 0 0 0 0 0 0 0 0 0
created datetime 0 0 0 0 0 0 0 0000-00-00 00:00:00 0 0 0
modified datetime 0 0 -1 0 0 0 0 0 0 0
first_name varchar 255 0 0 0 0 0 0 0 utf8 utf8_general_ci 0 0
last_name varchar 255 0 0 0 0 0 0 0 utf8 utf8_general_ci 0 0
client varchar 255 0 0 0 0 0 0 0 utf8 utf8_general_ci 0 0
societe varchar 255 0 0 0 0 0 0 0 utf8 utf8_general_ci 0 0
pays varchar 255 0 0 0 0 0 0 0 utf8 utf8_general_ci 0 0
email varchar 255 0 0 0 0 0 0 0 utf8 utf8_general_ci 0 0
phone varchar 255 0 0 0 0 0 0 0 utf8 utf8_general_ci 0 0
sujet varchar 255 0 0 0 0 0 0 0 utf8 utf8_general_ci 0 0
plateforme varchar 255 0 0 0 0 0 0 0 utf8 utf8_general_ci 0 0
service varchar 255 0 0 0 0 0 0 0 utf8 utf8_general_ci 0 0
message varchar 255 0 0 0 0 0 0 0 utf8 utf8_general_ci 0 0
The data examples:
1 029a8af4ce9129b0a0b2f5a6023eaf5521fa584e 281 2016-10-11 11:47:04 Letest Ceslui company EU car@lol.fr information All webmaster@mysite.com blabla
11 dc99130a8ffbe98007767244cc24708976f26608 281 2016-10-11 11:47:07
21 0bf2713c29a227467d55be5366f6ddecb031667c 281 2016-10-11 11:51:57 lebeta test info@stego.fr information All deb@mysite.com qsdfdfsdfsd
31 613ab088ad1046dc06b4f057d0bd7ba97b368c0f 281 2016-10-11 11:51:59
41 5cfe01ed5d3791a1dbba30c0a1f64dd3f6460027 281 2016-10-11 11:59:25 cgff fffgffg information All doubt@mysite.com ffgfgfg
51 988674616dce2f7bacc3f9de6db2c437fed27f8c 281 2016-10-11 11:59:28
The submit limit action is on 20 seconds with a message if fail. it never appears.
In html render form:
page = 1
submit event = submit ("transmettre" button type is submit)
form method = post
action url =
form class = chronoform
tag attachement =
sign required label = yes
relative url= yes
ajax = no
form tags = yes
xhtml = no
why???
this is a moment that I seek; so I decided to repeat the form.
I created a form : contact-interne-v2-FR, with no dbsave action (with a new table I have the same problem).
You can look the files join for looking my design and setup (more simple than before).
I tryed to add content = article (table content) => no problem.
The debug info for my new form:
Data Array
Array
(
[chronoform] => contact-interne-v2-FR
[event] => submit
[first_name] => carmine
[last_name] => eon
[societe] =>
[pays] =>
[email] =>
[phone] =>
[sujet] => information
[plateforme] => All
[service] => blabla@mysite.com
[message] => retourt
[submit6] => Transmettre
)
Array
(// THE PROBLEM I THINK !!
)
Errors
Array
(
)
Debug Info
Array
(
)
this is a moment that I seek; so I decided to repeat the form.
I created a form : contact-interne-v2-FR, with no dbsave action (with a new table I have the same problem).
You can look the files join for looking my design and setup (more simple than before).
I tryed to add content = article (table content) => no problem.
this is a moment that I seek; so I decided to repeat the form.
I created a form : contact-interne-v2-FR, with no dbsave action (with a new table I have the same problem).
You can look the files join for looking my design and setup (more simple than before).
I tryed to add content = article (table content) => no problem.
The debug info for my new form:
Data Array
Array
(
[chronoform] => contact-interne-v2-FR
[event] => submit
[first_name] => carmine
[last_name] => eon
[societe] =>
[pays] =>
[email] =>
[phone] =>
[sujet] => information
[plateforme] => All
[service] => blabla@mysite.com
[message] => retourt
[submit6] => Transmettre
)
Array
(// THE PROBLEM I THINK !!
)
Errors
Array
(
)
Debug Info
Array
(
)
The table structure:
id int 11 0 0 -1 0 0 0 0 -1 0
uniq_id varchar 50 0 0 0 0 0 0 0 utf8 utf8_general_ci 0 0
user_id int 11 0 0 0 0 0 0 0 0 0
created datetime 0 0 0 0 0 0 0 0000-00-00 00:00:00 0 0 0
modified datetime 0 0 -1 0 0 0 0 0 0 0
first_name varchar 255 0 0 0 0 0 0 0 utf8 utf8_general_ci 0 0
last_name varchar 255 0 0 0 0 0 0 0 utf8 utf8_general_ci 0 0
client varchar 255 0 0 0 0 0 0 0 utf8 utf8_general_ci 0 0
societe varchar 255 0 0 0 0 0 0 0 utf8 utf8_general_ci 0 0
pays varchar 255 0 0 0 0 0 0 0 utf8 utf8_general_ci 0 0
email varchar 255 0 0 0 0 0 0 0 utf8 utf8_general_ci 0 0
phone varchar 255 0 0 0 0 0 0 0 utf8 utf8_general_ci 0 0
sujet varchar 255 0 0 0 0 0 0 0 utf8 utf8_general_ci 0 0
plateforme varchar 255 0 0 0 0 0 0 0 utf8 utf8_general_ci 0 0
service varchar 255 0 0 0 0 0 0 0 utf8 utf8_general_ci 0 0
message varchar 255 0 0 0 0 0 0 0 utf8 utf8_general_ci 0 0
The data examples:
1 029a8af4ce9129b0a0b2f5a6023eaf5521fa584e 281 2016-10-11 11:47:04 Letest Ceslui company EU car@lol.fr information All webmaster@mysite.com blabla
11 dc99130a8ffbe98007767244cc24708976f26608 281 2016-10-11 11:47:07
21 0bf2713c29a227467d55be5366f6ddecb031667c 281 2016-10-11 11:51:57 lebeta test info@stego.fr information All deb@mysite.com qsdfdfsdfsd
31 613ab088ad1046dc06b4f057d0bd7ba97b368c0f 281 2016-10-11 11:51:59
41 5cfe01ed5d3791a1dbba30c0a1f64dd3f6460027 281 2016-10-11 11:59:25 cgff fffgffg information All doubt@mysite.com ffgfgfg
51 988674616dce2f7bacc3f9de6db2c437fed27f8c 281 2016-10-11 11:59:28
The submit limit action is on 20 seconds with a message if fail. it never appears.
In html render form:
page = 1
submit event = submit ("transmettre" button type is submit)
form method = post
action url =
form class = chronoform
tag attachement =
sign required label = yes
relative url= yes
ajax = no
form tags = yes
xhtml = no
why???
I make this test in my production site and his copy (developpment site).
In the prod site i have the same problem; but not in developpment site!
In prod site, i haven't problem if i maked an insert with sql in mysqladmin; no problem if i use an old form with his table; but if i use a new form with a new table: PROBLEM!!! 😈
joomla 3.6.2
Chronoforms V5 :
- module = V5 RC1.2
- composant = V5.0
- plugin = 5.0.12
- package = V5.0
Sorry for late.
First, i added a submit limit to 5 secondes and if he failed: event loop on load. it should be placed in the head's event.
This solves a part of the problem. But i need to reload the default captcha for submiting the form, else "wrong captcha". Why; i don't know😟
All my captcha no longer worked. I do not remember doing anything on my forms; and the same operating on a copy of the site.
Both versions have exactly the same versions of extensions.
I looked at the configuration of my server and IIS on both hosts are identical.
I thought of a problem during an update, perhaps.
But I have not wanted to lose more time, I replaced my captcha by recaptcha google service: and it works, of course.
Between the captcha and an "unknown bug" that crééait enregitrements me two instead of one (one empty), it was difficult to understand.
The problem is solved.