validate data at serverside

Hello,

I build a small form and want to validate data at serverside.
-loading data via xml seems to work fine.
-when i press ‘save’ it does not send all fields (only these 2: [object Object]&ids=340 )

gr,
Niek

I used this script in htmlpage:

<script>
	var myForm, mygrid, formData;
	function doOnLoad() {
		formData = [
			{type: "settings", position: "label-left", labelWidth: 120, inputWidth: 160},
			{type: "label", label: "Persoon"},
			{type: "input", name: "OBJECTS_ID", label: "Objects_ID", value: "", validate:"NotEmpty"},
			{type: "input", name: "CommonName", label: "Gebruikersnaam", value: "", validate:"NotEmpty"},
			{type: "input", name: "LoginName", label: "Loginnaam", value: "", validate:"NotEmpty"},
			{type: "input", name: "PersonalNumber", label: "PersonalNumber", value: ""},
			{type: "password", name: "LoginPassword", label: "LoginPassword", value: ""},
			{type: "calendar", dateFormat: "%Y-%m-%d %H:%i", name: "FromTime", label: "FromTime", value: ""},
			{type: "input", name: "UntilTime", label: "UntilTime", value: ""},
			{type: "label", label: "Profielen"},
			{type: "select", label: "Role_ID", options:[
				{text: "Operators", value: "1"},
				{text: "TD", value: "2", selected: true},
				{text: "Management", value: "3"},
				{text: "Administrators", value: "4"}
			]},
			{type: "button", value: "Load via obj_conn", name: "set1"},
			{type: "button", value: "Load via dhtmlx conn", name: "set2"},
			{type: "button", value: "Save", name: "send"}
			
		];
		myForm = new dhtmlXForm("myForm", formData);
		myForm.attachEvent("onButtonClick", function(id){ 
			if (id == "set1") 
				myForm.load('obj_conn.php?id=340'); 
			if (id == "set2") 
				myForm.load('test_conn.php?id=340'); 
			if (id == "send") 
				myForm.save(id); 
		});
		
		var dp = new dataProcessor('test_conn.php');
		dp.init(myForm);

Hello,

there was a problem with sending calendar date. Please try to use attached libraries instead of the originals.
dhtmlxform_item_calendar.zip (1.98 KB)
dhtmlxform.zip (14.9 KB)

Dear Support,

I found the bug was in :
myForm.save(id); should be => myForm.save();

Now i try to send a custom message from php server side:

PHP code:
header(‘Content-Type: text/xml’);
echo ’ ‘.$Message.’’;

js code (in combination with dhtmlxform) :
function my_action(node){
alert(node.getAttribute(“type”)); // my_error
alert(node.firstChild.data); // Details
return false;
}
var dp = new dataProcessor(’/update.php?id=292’);
dp.init(myForm);
dp.defineAction(“my_error”,my_action);

This does not give an error but i don’t get to see the message, any idea how to fix this?!

regards,
Niek

Unfortunately we cannot reproduce this issue locally. Make sure if you are using:

dp.defineAction(“my_error”,my_action)

Dear Support,

The updated calender files solve one problem with date format send back to the server, thx.

But when i empty the calendar date field by hand, the value send to the server stays the old value (instead of empty field).

regards,
Niek

Problem was confirmed and fixed.

Please try to use attached js file instead of original one
(the same fix will be added to the next version of component)
dhtmlxform_item_calendar.zip (1.18 KB)
dhtmlxform.zip (15.2 KB)