## Function(treeId, treeNode, newName, isCancel)setting.callback.beforeRename

### Overview[ depends on jquery.ztree.exedit js ]

Specify callback function to be called before rename(when input DOM blur or press Enter Key), The return value controls the allow to rename node.

When node is editing name, press the ESC key to restore the original name and stop edit name.

From v3.5.13, zTree will trigger this callback when user cancel edit name. please see 'isCancel' parameter.

Default: null

### Function Parameter Descriptions

#### treeId String

zTree unique identifier: treeId.

#### treeNode JSON

JSON data object of the node to be rename.

#### newName String

the new name

#### isCancel Boolean

the status about cancel edit name (v3.5.13+)

isCancel = true means: user cancel edit name. (press ESC or use cancelEditName() function)

isCancel = false means: user submit edit name.

#### Return Boolean

return true or false

If return false, the treeNode will keep the editing name, don't trigger the 'onRename' callback, and will ignore other enents, until the callback return true.

If returns false, zTree will not set the input box to get focus to avoid the warning message which led to repeated triggering ‘beforeRename’ callback. Please use editName() method to set the input box to get focus when user close the warning message.

### Examples of setting & function

#### 1. the length of the new name can't less than 5

    function myBeforeRename(treeId, treeNode, newName, isCancel) {
    	return newName.length > 5;
    }
    var setting = {
    	edit: {
    		enable: true
    	},
    	callback: {
    		beforeRename: myBeforeRename
    	}
    };
    ......