Date format when saving through DataProcessor

Hi there

I am trying to save a form through the dataprocessor ( using form.save() ), but it seems the date format I set is not the format that is sent to the server side.

Here is how I set up the form element:
{type:“calendar”, name:“ValidFrom”, label:“Valid From”, labelAlign:“left”, required:true, validate:‘NotEmpty’, dateFormat: “%Y/%m/%d”, serverDateFormat: “%Y/%m/%d”, inputWidth:100, },

I have also used the form’s method to set the date format:
dhxFormDeal.setCalendarDateFormat(“ValidFrom”, “%Y/%m/%d”, “%Y/%m/%d”);

When tracing the events in the console I get this
dhxFormDeal_onValidateSuccess (input=ValidTo, value=Fri Jan 10 2014 18:00:00 GMT+0200 (South Africa Standard Time), result=true)

I even tried overriding the value before validation like so:
function dhxFormDeal_onBeforeValidate(id) {
console.log(‘dhxFormDeal_onBeforeValidate(id=’+id+’)’);
console.log(dhxFormDeal.getItemValue(‘ValidFrom’));
dhxCalendar = dhxFormDeal.getCalendar(‘ValidFrom’);
console.log(dhxCalendar.getDate(true));
dhxFormDeal.setItemValue=dhxCalendar.getDate(true);
return true;
}

Above output is:
dhxFormDeal_onBeforeValidate(id=undefined)
Sat Feb 01 2014 18:00:00 GMT+0200 (South Africa Standard Time)
2014/02/01

The reason this is a problem is because I am using CodeIgniter and that it is blocking the posting because of disallowed key characters.

Please let me know how I can get it to send the correct date format through form.save() or otherwise I will have to code the AJAX post manually

Thanks

Which version of form you are using ?
If you are using 3.6 - date format must be used automatically while sending the updated data to the server side.

Are you using form and dataprocessor alone, or a more complex scheme with form, datastore and dataprocessor ( in second case the problem is still actual for the latest form, but we already have a fix )

Hi Stanislav

Yes, it is 3.6 (131108). No datastore, only form and dataprocessor.

Here is some code to reproduce what I experienced.


The form connector is very simple (it is within CodeIgniter), but will probably be the same for any table to connect to

public function master_formConnector() {
	$connector = new FormConnector($this->db, "PHPCI");
	$connector->render_table("abStockPriceListDealMaster", "Code", "Code, Description, ValidFrom, ValidTo, Debtor, Pricelist");
}

just to be sure that you are using latest version of dhtmlxform - please try to update existing file with the attached one.
dhtmlxform.zip (22.1 KB)