<% 
	import org.exoplatform.webui.form.UIFormInputBase;
	
	def rcontext = _ctx.getRequestContext();
	rcontext.getJavascriptManager().require("SHARED/uiForm");
	String fieldName; %>
<div class="uiFormWithTitle uiBox uiGroupForm" onkeypress="javascript:SubmitAction.call(this, event);">
	<h5 class="title"><%=_ctx.appRes(uicomponent.getName() + ".title")%></h5>
	<% uiform.begin() %>
	<div class="uiContentBox">
		<div class="form-horizontal">
			<% 
				for(field in uiform.getChildren()) { 
					if(field.isRendered()) {
			%>
						<div class="control-group">
							<%fieldName = uicomponent.getLabel(field.getName());%>
							<%if(field instanceof UIFormInputBase && !fieldName.equals(uicomponent.getId())) { %>												
								<label class="control-label portlet-form-label">
									<%if(fieldName != null && fieldName.length() > 0) {%> 
										<%=uicomponent.getLabel(field.getName()) %>
									<%}%>
								</label>
								<% if(field instanceof UIFormInputBase && field.isEditable()) { %>
									<div class="controls portlet-input-field"><% uiform.renderField(field) %></div>
								<% }else { %>
									<div class="controls NonEditableField portlet-input-field"><% uiform.renderField(field) %></div>
								<% } %>	
							<%} else {%>
								<div class="controls-full"><% uiform.renderField(field) %></div>
							<%}%>
						</div>
			<%
					}
				}
			%>
		</div>
		<%//Rerender this	component with the new structure%>
		<%// start render action%>
		<div class="uiAction uiActionBorder"> 
			<% for(action in uicomponent.getActions()) { 
					 String actionLabel = _ctx.appRes(uicomponent.getName() + ".action." + action) 
					 String link = uicomponent.event(action); 
			%>
				<button type="button" onclick="$link; window.scroll(0,0);" class="btn">$actionLabel</button>
			<%}%>
		</div>
		<%// end render action%>
	</div>
	<%uiform.end()%>
</div>
<script language="javascript">
	function SubmitAction(event) {
		var event = window.event || event;
		var code;
		if(event.keyCode) code = event.keyCode;
		else if (event.which) code = event.which;
		if(code ==13) {
			this.onsubmit = function(){ return false; }				
		}
	}	
</script>
