Inline editing & validation

Inline editing & validation

renatilorenatilo Posts: 3Questions: 1Answers: 0

Hi,

I am experiencing problems getting the Editor 1.4.0 plug-in (DataTables v1.10.5) working. It seems that the inline editing is not quite functional.

I built a simple grid that consists of several text columns, all of them get validated on the server, which then eventually returns errors. The grid is being edited in inline mode with the "submitOnBlur" option set. Initially all cells are blank (=invalid).

Since the entire row gets submitted for validation upon changes in a single cell, the grid is supposed to highlight the first invalid cell after the server reponse is recieved (as stated in product's JS code, line 4192 onwards, "Scroll the display to the first error and focus"). Instead of that, the focus remains in the currently edited field, no error messages are shown, and any attemts to click another fields trigger yet another server request. The user gets locked in active cell forever.

Inline editing of rows that contain server-side validators is therefore not possible at all.

I would appreciate if you could assist me with this issue.

Cheers,

Danil Kister

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    Hi Danil,

    If I understand correctly, the row that is being edited contains invalid information that is not in the field being edited - is that correct? Therefore the server is responding with a validation error for a field other than the one being edited.

    Daft question possibly, but how did a row get into the table that is not valid?

    Having said that, this validation issue is not unique to 1.4 - it has been present since 1.3 when inline editing was introduced. It will correctly display validation errors for the field being edited, but not for other fields - which is something that I very certainly need to address. Thanks for bringing that up.

    Regards,
    Allan

  • renatilorenatilo Posts: 3Questions: 1Answers: 0

    Hi,

    this is right. The edited field contains a valid value, another field does not pass the validation => user gets stuck in the correct field.

    It would be great if you could propose a workaround until the issue is fixed.
    Many thanks!

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    You could listen for postSubmit and display any error messages using a custom function. But really the best fix would be to ensure that the data was valid before it is displayed.

    Allan

  • renatilorenatilo Posts: 3Questions: 1Answers: 0

    The real fix would be to highlight invalid values and let the user correct them - just imagine a row with several invalid cells picked up from the database :-)

    Thanks for the workaround anyway !

This discussion has been closed.