Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by J. Atwood on Jun 03, 2009 10:56
open dhtmlx forum
Consistent presention of validation errors

Hi,
I'm implementing a dhtmlXGrid that allows users to post changes back to a web application. I've also implemented some basic validation, after referencing the "Save Data Dynamically" sample. I have a "checkIfNotZero" function that's being used as a verificator client-side (i.e. myDataProcessor.setVerificator(3,checkIfNotZero)).

I also have some validation that must take place on the server. To accomplish this, I added a "myErrorHandler_1001" function and defined it for the "error_1000" action (i.e. myDataProcessor.defineAction("error_1001",myErrorHandler_1001)).

I noticed that the client-side checkIfNotZero verificator highlights in red rows with validation errors as well as underlining the actual column in error. How can something similar be accomplished with server-side validation errors (i.e. error_1001 action, which might correspond to an unavailable scheduling block in a scheduling application)?

I'd like to have a consistent way of presenting validation errors, regardless of whether they are determined client-side or server-side.

Thanks,
J
Answer posted by Support on Jun 04, 2009 02:48
You can call the next method from your custom error function

dp.set_invalid(rowId,"invalid",c_invalid);
dp.setUpdated(rowId,false);


where 
    dp - dataprocessor
    rowId - id of the row
    c_ivalid - optional collection of true|false values for each column, columns for which value as true will be underlined 


dp.set_invalid(rowId,"invalid");
or
dp.set_invalid(rowId,"invalid",[true,false,false]);