Search code examples
javascriptasp.net-mvcjquery-dialog

When should I not leave on the data integrity on client side in javascript


I am showing an Edit treenode dialog with JQuery UI Dialog. The user selects a treenode and then clicks the edit link. The dialog opens and displays the name of the selected node in a textbox to edit it.

In my treenode I save the id + name. When I open the JQuery dialog in my GET request I pass the treenode Id to the mvc controller which gets my the name of the treenode from the database.

Well, is there any reason why I should not get the name directly from the selected treenode which would easen some things ?


Solution

  • The only downside I can see is that, if this system is used by multiple users simultaneously, the tree node might have been changed or even deleted in the database between the initial load and the time you want to rename it. By getting fresh data from the database you can notify the user about this up front.

    If this is not an issue for you, go for it.