form bug: INSERTS once, UPDATES second time, INSERT 3rd time

So I have a very very weird bug and I cannot find the origin. I have a grid with a window and a form attached to it. It all works, however, every 2nd insert with the form UPDATES the last inserted record instead of inserting!

This is my form that gets loaded:

[code] var w1, myForm;

dhxWins = new dhtmlXWindows();
dhxWins.attachViewportTo("gridbox");
// ACTION WINDOW
w1 = dhxWins.createWindow("w1", 20, 30, 460, 410);
w1.attachEvent("onClose", function(){
	w1.hide();
	$('div#gridbox').css('opacity','1');
});
w1.center();
w1.hide();

//ATTACH FORM TO ACTION WINDOW	
myForm = w1.attachForm();
myForm.loadStruct("<?php echo bloginfo('template_url'); ?>/jtc/task_action_formcontents.json");
var dp_f = new dataProcessor("<?php echo bloginfo('template_url'); ?>/jtc/task_action_conn.php?action=insert");
dp_f.init(myForm);
myForm.attachEvent("onButtonClick",function(buttonID){
	if(buttonID=="submit"){
		myForm.save();//no params needed.It uses url that you passed to dataprocessor
		myForm.clear();
		mygrid.updateFromXML("<?php echo bloginfo('template_url'); ?>/jtc/task_manager_conn.php");

		w1.hide();
		//doOnLoad();
	}
});

[/code]

I use the “action=insert” at the dataProcessor.

Here’s my php-connector:

$form = new FormConnector($conn); $form->enable_log("log.txt"); $form->render_table("wp_task_actions","id","last_completion_percentage,completion_percentage,duration_hours,taskaction_notes,taskaction_user,id_task,created_taskaction");

BTW, I cannot find the log files anywhere, I think my wordpress framework are blocking them from being saved…

Any ideas?

I tried
myForm.resetDataprocessor(“inserted”);
But it says resetDataprocessor is not a function.
I tried
myForm.reset();

But nothing works…

When looking at the NETWORK tab in chrome, and previewing the connector.php, the first time it says:



The second time it says:


I have no idea why… I never wrote it to update anywhere. Could I limit the connector to only give it the insert functionality? Or make sure to keep the insert action type after inserting?

Hello

  1. it is not a bug - it is a feature
  2. there is a method resetDataprocessor in dhtmlxForm:
    docs.dhtmlx.com/api__dhtmlxform_ … essor.html
  3. you can also call form.clear()

This is what my PHP error log file says:

[Fri Nov 20 22:40:12 2015] [error] [client 118.238.203.52] PHP Warning: error_log(log.txt): failed to open stream: Permission denied in /var/www/vhosts/jtc.ae/httpdocs/pre/wp/wp-content/themes/Amazing_japan_HP/frameworks/dhtmlx/dhtmlxConnector_php_v15_120612/codebase/tools.php on line 210, referer: http://jtc.ae/jtc_manage/?action=task

Dear Darya,
Which part in my code exactly enables this feature?
Also, the documentation says:
myForm.resetDataprocessor
But this function doesn’t exist…

Shouldn’t it be myForm.resetDataProcessor?
With a capital letter P?

error_log(log.txt): failed to open stream:

You have enabled logging in connector, but log folder is write-protected

myForm.resetDataprocessor

It does exists. Please be sure that you are using the latest version of dhtmlxForm.
If issue still occurs - please share a snippet or a sample where issue can be reconstructed ( the client side code will be enough )