Xform is not saving some variables on first edit

Hi everyone, I am using openmrs 2.2.1 and xform module 4.3.14. I have notice that one of my form when I save edited form when I edit the first time some variables are not saved in mysql they are just voided. When i edit the second time and save the form that is when they are save. These variables(concepts) are datetime and value_numeric. Does anyone have an idea what can cause this?

This is what you see on mysql when you save the first edit This is what you see when you edit and save the second time

Are you able to reproduce this on a small brand new form?

Yes. Here is a small form but I have used one of the same concepts. It is behaving the same.

This is what I see in mysql, the first query is when I save the form and the second query is when I edit for the first time

Can you describe, in detail, the problem in relation to the second small form and for a specific concept?

First of all I am using xform to edit the data. So when you open the form and edit for example in sample form RECEIVED_DATE_TIME and save the form. When you open mysql and chech if the value for the concept has been capture that is when you see it has only be voided. But if you open the form to edit it the second time and save the form the new value which is not voided also appeared in mysql. So for example if edit something and run sql query I was supposed to see two values the one that is voided and one that is not voided.

I had notice this because I was using this concept on openmrs report and if someone edit this variable it appears blank on the report.

Can you also try another sample form that has only one obs which is value_numeric and repeat that process?

So with numeric variable on this form that I created even when I edit more than once in mysql it still shows the value is voided even when I edit it several times. As you can see on the it has submitted successfully after edit.

What results do you get when you remove the obs_datetime filter from your sql statement?

Here is the results

Can we make it simpler by doing this on a new patient who does not yet have any observations?

I have created a new patient and test with my new testing form and it seems to be working fine.

But with the actual form it still behave the same. When you edit the first it just void the value the second time it is when it not voided.

First query value numeric 12 with voided=0 is when I submit the form. Second query value numeric 12 with voided=1 when I edit the first time. Third query value numeric 20 with voided=0 when i edit the second time and change 12 to 20.

So is the problem happening for existing patients but not new patients?

No. Even for new patients when I use the actual form and not the testing form.

Can you send me via pastebin.com, the section that is added to the server side log file only when you click submit?

Here is the logs on first form submit. xform not saving edited data1 - Pastebin.com

Can you send the form’s xml definition via pastebin.com?

Here is the form’s xml. form xml - Pastebin.com

I mean the one that you get after saving as from the file menu.

Sorry! Here is the xml. sample form xml - Pastebin.com