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

<#form id="${formId}" objectCode="${object.code}" 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);
			$.widgetLoad($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 = "add";
</script>
<%if(!isEmpty(object.diy_js!)){%>
<script type="text/javascript" src="${object.diy_js}"></script>
<%}%>

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