<%var body = {
	var formId = 'updateForm' + object.code;
	var url = '/form/doUpdate/' + object.code;
%>

<#form id="${formId}" objectCode="${object.code}" data="${record!}" fixed="${fixed!}" />

<script type="text/javascript">
var $form = $('#${formId}');

var submitNow = function($dialog, $widget, $pjq) {
	var $btnSave = $pjq("#eovaSave");
	$btnSave.linkbutton({disabled : true});
	var i = 3;
	function count() {i--;
		if(i == 0){$btnSave.linkbutton({disabled : false});return;}
		setTimeout(function() {count()}, 1000)
	}
	count();
	
    $.post('${url}', $.getFormParasObj($form), function(result) {
		if (result.success) {
        	$.slideMsg($.str.format($.I18N('修改成功'), '${object.name}'), $pjq);
        	$.widgetReLoad($widget);
            $dialog.dialog('destroy');
        } else {
        	$.alert($pjq, result.msg);
		}
	}, 'json');
};

var btnSaveCallback = function($dialog, $widget, $pjq) {
	// nice validator
	$form.isValid(function(isValied) {
		if (isValied) {
			submitNow($dialog, $widget, $pjq);
		}
	});
};

var EOVA_FORM = "update";
</script>
<%if(!isEmpty(object.diy_js!)){%>
<script type="text/javascript" src="${object.diy_js}"></script>
<%}%>

<%};include("/eova/layout/default.html",{'title' : 'update' + object.name, 'layoutContent' : body, 'isEditor' : true}){}%>