Show error on inline edit?

Show error on inline edit?

StevenRaekelboomStevenRaekelboom Posts: 5Questions: 2Answers: 0

Hi,

when using the inline edit I can't get the editor to show the reported error. I think I've followed the proper instructions.
The response from the server after submit looks typically like this:

{"data":[{"id":"1479820183409","Product_code":"aaaa"}],"error":"Cannot change the product code!"}

Shouldn't that work?

This question has accepted answers - jump to:

Answers

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

    You need to return a field error for inline editing errors.

    Allan

  • StevenRaekelboomStevenRaekelboom Posts: 5Questions: 2Answers: 0

    Thank you Allan.
    In my case, although the example would suggest otherwise, the client code is not aware of where the error is located and in this particular case even, the error is generated by a database trigger so it could be the result of a compound rule impacting multiple fields.
    Do I understand it correctly that using 'error' is not working?
    FWIW, I solved it ad interim by handling the submitComplete event and showing a dialog to the user when the json contains an error.

    Regards,
    Steven

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

    Yes, unfortunately the global error is not currently shown when inline editing. That is something I will fix for 1.6 (which will drop in early December).

    What you would need to do is listen for postSubmit (or submitComplete as you have done) and detect the error. They you could alert() it (in the worst case) or use field().error() to show it in the field's error message.

    Allan

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

    Just to confirm - this has been committed now and will be in 1.6.

    Allan

  • StevenRaekelboomStevenRaekelboom Posts: 5Questions: 2Answers: 0

    A bit late but...thanks!!

    Steven

This discussion has been closed.