Hi, sometimes when I insert a new record Chronoform inserts twice record.
This problem does not always occur, it seems that the records are duplicated random.
This problem does not always occur, it seems that the records are duplicated random.
Hi cenzomita,
Very unlikely that this is random - there will be some pattern.
Is it possible that the user is clicking Submit more than once?
Bob
Very unlikely that this is random - there will be some pattern.
Is it possible that the user is clicking Submit more than once?
Bob
Hi,
I don't think that the problem is the multiple submit, otherwise the cases would be few.
I don't think that the problem is the multiple submit, otherwise the cases would be few.
Hi cenzomita,
Please drag a Debugger action into the On Submit event, then submit the form and post the debug - including the 'dummy emails' results here.
Note: if you are using the Easy Wizard you can turn on Debug on the Others tab in CFv4 or the Setup tab in CFv5.
Bob
Please drag a Debugger action into the On Submit event, then submit the form and post the debug - including the 'dummy emails' results here.
Note: if you are using the Easy Wizard you can turn on Debug on the Others tab in CFv4 or the Setup tab in CFv5.
Bob
Hi Bob, excuse me if I don't reply but the problem seemed to occur more. Unfortunately I found duplicated records.
In my form I have a not-editable field code automatically generated with a timestamp using the following JS code
I noticed that in database there are two records with the same code but the creation date ("created" field on database table) different, 1 hour of difference. How it it possible?
This condition should exclude the multiple click on submit button.
The value of "created" field of db when is calculated?
In my form I have a not-editable field code automatically generated with a timestamp using the following JS code
function loadNumBolla() {
var d;
if (!Date.now) {
d = Date().getTime();
} else {
d = Date.now();
}
d = d / 1000 | 0;
$('numero_bolla').value = d;
}
I noticed that in database there are two records with the same code but the creation date ("created" field on database table) different, 1 hour of difference. How it it possible?
This condition should exclude the multiple click on submit button.
The value of "created" field of db when is calculated?
Hi cenzomita,
Unless you have an entry in $form->data['created'] then the 'created' date+time is set when the database query runs i.e. when the record is saved.
Bob
Unless you have an entry in $form->data['created'] then the 'created' date+time is set when the database query runs i.e. when the record is saved.
Bob
Ok, then you agreed with me that it is not possible that the records are created at the same time.
It is difficult for user create two records with the same "numero_bolla" (created with timestamp) and creation field very different.
Do you have an ideas about problem?
It is difficult for user create two records with the same "numero_bolla" (created with timestamp) and creation field very different.
Do you have an ideas about problem?
Hi cenzomita,
Sorry, I have no good ideas at all. Are they exactly one hour apart - in which case it might??? be something to do with time-zones?
Bob
Sorry, I have no good ideas at all. Are they exactly one hour apart - in which case it might??? be something to do with time-zones?
Bob
The difference between their data creation is not exactly 1 hour, but substantially the problem is that it is not possible to have two records with the same timestamp generated.
I don't understand where is the problem. I have think also that the records are duplicated for a reason and queued for database insertion, but 1 hour is too much.
I don't understand where is the problem. I have think also that the records are duplicated for a reason and queued for database insertion, but 1 hour is too much.
Hi cenzomita,
I doubt that any database delay is more than a second or two. The cause of this is somewhere else.
Bob
I doubt that any database delay is more than a second or two. The cause of this is somewhere else.
Bob
Hi Bob,
the problem above is not resolved, but from some days it is aggravated.
When I insert a new record Chronoform inserts multiple records (something 7-8 records).
the problem above is not resolved, but from some days it is aggravated.
When I insert a new record Chronoform inserts multiple records (something 7-8 records).
Hi cenzomita,
These are all with the same time-stamp or at different times?
There is nothing that I know of in ChronoForms that will create duplicated records at different times.
Bob
These are all with the same time-stamp or at different times?
There is nothing that I know of in ChronoForms that will create duplicated records at different times.
Bob
Yes Bob, all records have the same time-stamp.
The records have a field (a code) which value is calculated by timestamp, these values are the same for all duplicated records. Then, these records have the "created field" with the same date but different time, you can see the attachment.
[attachment=0]scrshot.png[/attachment]
The records have a field (a code) which value is calculated by timestamp, these values are the same for all duplicated records. Then, these records have the "created field" with the same date but different time, you can see the attachment.
[attachment=0]scrshot.png[/attachment]
The following attachment shows the "numero_bolla" field that contains the time-stamp in millisecond
[attachment=0]scrshot.png[/attachment]
[attachment=0]scrshot.png[/attachment]
Hi cenzomita,
Your 'numero_bolla' is created once when the form is submitted; the 'created' value is set when the MySQL query runs.
I can only guess that there is a loop somewhere and the DB Save is being re-run . . . I have no idea where though.
Bob
Your 'numero_bolla' is created once when the form is submitted; the 'created' value is set when the MySQL query runs.
I can only guess that there is a loop somewhere and the DB Save is being re-run . . . I have no idea where though.
Bob
Hi Bob,
I don't find any loop. Then I don't think in a loop cause because this multiple insertion does not occur always.
Where should I check?
I don't find any loop. Then I don't think in a loop cause because this multiple insertion does not occur always.
Where should I check?
In setup tab I have the following codes:
on onload I inserted a "load javascript" with the following code to enable all field before submit
on onsubmit I inserted custom code to format data fields
event switcher to send mail in particular conditions
a final custom code to print page
Can you see problems?
on onload I inserted a "load javascript" with the following code to enable all field before submit
window.addEvent('domready', function()
{
...
$('chronoform-spedizione_insert').addEvent('submit',enabler);
}
);
function enabler()
{
var inputs = document.getElementsByTagName('input');
for (i=0; i<inputs.length; i++){
inputs[i].disabled='';
}
}
on onsubmit I inserted custom code to format data fields
<?php
$user = JFactory::getUser();
$form->data['cliente'] = $user->name;
$form->data['data_bolla'] = date('d-m-Y');
if (strlen($form->data['note_cliente']) > 0)
{
$form->data['note_presenti'] = "X";
}
if (strlen($form->data['data_ritiro']) > 0)
{
$form->data["data_ritiro_convert"] = date("Y-m-d", strtotime($form->data["data_ritiro"]));
}
?>
event switcher to send mail in particular conditions
<?php
if (array_key_exists("priorita", $form->data) && $form->data["priorita"] =="Urgente"){
return "success";
}else{
return "fail";
}
?>
a final custom code to print page
<?php
$doc = JFactory::getDocument();
$script = "
jQuery(document).ready(function(jQ){
function printPage()
{
var html, css, csss_file, printWin;
css = \"\";
css = \"<style type='text/css'>\"+css+\"</style>\";
css_url = '';
if ( css_url !== '' ) {
css_url = \"<link rel='stylesheet' type='text/css' href='\"+css_url+\"' media='print' />\";
}
html = '<html><head>'+css+css_url+'</head>'+jQ(id).html()+'</html>';
printWin = window.open('', '', 'left=100, top=100, width=600, height=400, toolbar=0, scrollbars=0, status=0' );
printWin.document.write(html);
printWin.document.close();
printWin.focus();
printWin.print();
printWin.close();
}
var id;
id = '#print_div';
jQ('#print_button').css('visibility', 'visible');
jQ('#print_button').click(printPage);
});
";
$doc->addScriptDeclaration($script);
?>
Can you see problems?
Hi cenzomita,
Sorry but I don;'t have any suggestions about where to check. I haven't seen this reported before so I think it is most likely something about the way you have the form or site set up.
The code you posted looks OK - I don't see anything there that will cause a problem unless there is a submit button in the page you are using to print?
Bob
Sorry but I don;'t have any suggestions about where to check. I haven't seen this reported before so I think it is most likely something about the way you have the form or site set up.
The code you posted looks OK - I don't see anything there that will cause a problem unless there is a submit button in the page you are using to print?
Bob
When the user click on submit button the application execute the form submit, after the compilated form is automatically printed by the last code written in previous post.
If you wont I can give you the credential of my web site.
If you wont I can give you the credential of my web site.
No other suggestions for me?
My application is in pre-production, the users have inserted many data and waiting for production. I don't know if an update resolve the problem, or if I can have other problems.
Please, help me!
My application is in pre-production, the users have inserted many data and waiting for production. I don't know if an update resolve the problem, or if I can have other problems.
Please, help me!
Hi cenzomita,
I am pretty clear that this is a problem with the way you have the form set up, or possibly with your custom code so a ChronoForms upgrade is not going to help. By all means PM me the site URL, the form name, and a SuperAdmin login and I'll take a quick look - but I may not see the problem there.
Bob
I am pretty clear that this is a problem with the way you have the form set up, or possibly with your custom code so a ChronoForms upgrade is not going to help. By all means PM me the site URL, the form name, and a SuperAdmin login and I'll take a quick look - but I may not see the problem there.
Bob
Hi cenzomita,
I can’t work out what the form is supposed to do? Is it an Edit from from the CC listing? If so I can’t get any values to show in the CC listing to check that.
You appear to have both a CC Application linked to an Edit action which will save the record as well as a DB Save which will save the record.
I would expect the CC Application action to return the user to the listing so I'm not clear how the Print code works after that.
Bob
I can’t work out what the form is supposed to do? Is it an Edit from from the CC listing? If so I can’t get any values to show in the CC listing to check that.
You appear to have both a CC Application linked to an Edit action which will save the record as well as a DB Save which will save the record.
I would expect the CC Application action to return the user to the listing so I'm not clear how the Print code works after that.
Bob
The edit form (xxx_edit and xxx_edit_cliente) only have a link to CC with integrated save action.
The insert form (xxx_insert) has a DB save action, after a link to CC to show the list of items inserted after the save and the custom code for printing (it opens a new window that containt the compiled form that user can print).
Unfortunately it is a bit complex but I hope it is clear now.
The insert form (xxx_insert) has a DB save action, after a link to CC to show the list of items inserted after the save and the custom code for printing (it opens a new window that containt the compiled form that user can print).
Unfortunately it is a bit complex but I hope it is clear now.
Hi Bob, after several months the problem still exists.
Is there a solution? Could I resolve it if I update to last version of component?
Can I lost the customization with update?
Is there a solution? Could I resolve it if I update to last version of component?
Can I lost the customization with update?
Hi cenzomita,
I still don't have any suggestions except that you debug what is happening step by step to see if you can pin down exactly where the loop is happening.
Yes, please do upgrade CF and CC to the latest versions - but I don't think that will make any difference. There is something in the way you have this combination set up that is causing the duplication.
Bob
I still don't have any suggestions except that you debug what is happening step by step to see if you can pin down exactly where the loop is happening.
Yes, please do upgrade CF and CC to the latest versions - but I don't think that will make any difference. There is something in the way you have this combination set up that is causing the duplication.
Bob
This topic is locked and no more replies can be posted.