Skip to content

Commit

Permalink
TRUNK-3882 Custom tag to render errors
Browse files Browse the repository at this point in the history
(cherry picked from commit be50e0d)

Conflicts:
	webapp/src/main/webapp/WEB-INF/view/admin/concepts/conceptReferenceTermForm.jsp
	webapp/src/main/webapp/WEB-INF/view/admin/concepts/conceptStopWordForm.jsp
	webapp/src/main/webapp/WEB-INF/view/admin/encounters/encounterForm.jsp
	webapp/src/main/webapp/WEB-INF/view/admin/forms/formEditForm.jsp
	webapp/src/main/webapp/WEB-INF/view/admin/locations/locationForm.jsp
	webapp/src/main/webapp/WEB-INF/view/admin/observations/obsForm.jsp
	webapp/src/main/webapp/WEB-INF/view/admin/patients/mergePatientsForm.jsp
	webapp/src/main/webapp/WEB-INF/view/admin/patients/patientForm.jsp
	webapp/src/main/webapp/WEB-INF/view/admin/patients/shortPatientForm.jsp
	webapp/src/main/webapp/WEB-INF/view/admin/person/personForm.jsp
	webapp/src/main/webapp/WEB-INF/view/admin/scheduler/schedulerForm.jsp
	webapp/src/main/webapp/WEB-INF/view/admin/users/alertForm.jsp
	webapp/src/main/webapp/WEB-INF/view/admin/users/changePasswordForm.jsp
	webapp/src/main/webapp/WEB-INF/view/admin/users/roleForm.jsp
	webapp/src/main/webapp/WEB-INF/view/admin/users/userForm.jsp
	webapp/src/main/webapp/WEB-INF/view/admin/visits/visitForm.jsp
	webapp/src/main/webapp/WEB-INF/view/dictionary/conceptForm.jsp
	webapp/src/main/webapp/WEB-INF/view/optionsForm.jsp
  • Loading branch information
jkondrat authored and rkorytkowski committed Mar 17, 2014
1 parent 14458eb commit ba6641f
Show file tree
Hide file tree
Showing 20 changed files with 31 additions and 115 deletions.
2 changes: 1 addition & 1 deletion webapp/src/main/webapp/WEB-INF/messages.properties
Expand Up @@ -26,7 +26,7 @@ Navigation.administration = Administration
Navigation.options = My Profile
Navigation.calendar = Calendar

fix.error=<div class="error">Please fix all errors and try again.</div>
fix.error=Please fix all errors and try again.
fix.error.plain=Please fix all errors and try again.

error.general=Error while submitting form
Expand Down
11 changes: 11 additions & 0 deletions webapp/src/main/webapp/WEB-INF/tags/errorNotify.tag
@@ -0,0 +1,11 @@
<%@ include file="/WEB-INF/template/include.jsp" %>

<%@ attribute name="errors" required="true" type="org.springframework.validation.Errors" %>

<div class="error"><openmrs:message code="fix.error"/></div>
<div class="error">
<c:forEach items="${errors.allErrors}" var="error">
<openmrs:message code="${error.code}" text="${error.code}"/><br/>
</c:forEach>
</div>
<br />
Expand Up @@ -111,13 +111,7 @@ $j(document).ready( function() {
</c:if>

<spring:hasBindErrors name="conceptReferenceTermModel">
<openmrs:message htmlEscape="false" code="fix.error"/>
<div class="error">
<c:forEach items="${errors.allErrors}" var="error">
<openmrs:message code="${error.code}" text="${error.code}"/><br/>
</c:forEach>
</div>
<br />
<openmrs_tag:errorNotify errors="${errors}" />
</spring:hasBindErrors>

<form:form method="post" action="conceptReferenceTerm.form" modelAttribute="conceptReferenceTermModel">
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/main/webapp/WEB-INF/view/admin/concepts/conceptStopWordForm.jsp 100755 → 100644
Expand Up @@ -10,7 +10,7 @@
<h2><openmrs:message code="ConceptStopWord.title"/></h2>

<spring:hasBindErrors name="command">
<openmrs:message htmlEscape="false" code="fix.error"/><br/>
<div class="error"><openmrs:message code="fix.error"/></div><br/>
</spring:hasBindErrors>

<form method="post">
Expand Down
8 changes: 1 addition & 7 deletions webapp/src/main/webapp/WEB-INF/view/admin/encounters/encounterForm.jsp 100755 → 100644
Expand Up @@ -219,13 +219,7 @@
<h2><openmrs:message code="Encounter.manage.title"/></h2>

<spring:hasBindErrors name="encounter">
<openmrs:message htmlEscape="false" code="fix.error"/>
<div class="error">
<c:forEach items="${errors.allErrors}" var="error">
<openmrs:message code="${error.code}" text="${error.code}"/><br/>
</c:forEach>
</div>
<br />
<openmrs_tag:errorNotify errors="${errors}" />
</spring:hasBindErrors>

<b class="boxHeader"><openmrs:message code="Encounter.summary"/></b>
Expand Down
7 changes: 1 addition & 6 deletions webapp/src/main/webapp/WEB-INF/view/admin/forms/formEditForm.jsp 100755 → 100644
Expand Up @@ -8,12 +8,7 @@
<h2><openmrs:message code="Form.edit.title"/></h2>

<spring:hasBindErrors name="form">
<openmrs:message htmlEscape="false" code="fix.error"/>
<div class="error">
<c:forEach items="${errors.allErrors}" var="error">
<openmrs:message code="${error.code}" text="${error.code}"/><br/><!-- ${error} -->
</c:forEach>
</div>
<openmrs_tag:errorNotify errors="${errors}" />
</spring:hasBindErrors>

<c:if test="${form.retired}">
Expand Down
8 changes: 1 addition & 7 deletions webapp/src/main/webapp/WEB-INF/view/admin/locations/locationForm.jsp 100755 → 100644
Expand Up @@ -25,13 +25,7 @@
</c:if>

<spring:hasBindErrors name="location">
<openmrs:message htmlEscape="false" code="fix.error"/>
<div class="error">
<c:forEach items="${errors.globalErrors}" var="error">
<openmrs:message code="${error.defaultMessage}" text="${error.defaultMessage}"/><br/><!-- ${error} -->
</c:forEach>
</div>
<br />
<openmrs_tag:errorNotify errors="${errors}" />
</spring:hasBindErrors>
<form method="post">
<fieldset>
Expand Down
8 changes: 1 addition & 7 deletions webapp/src/main/webapp/WEB-INF/view/admin/observations/obsForm.jsp 100755 → 100644
Expand Up @@ -217,13 +217,7 @@
<h2><openmrs:message code="Obs.title"/></h2>

<spring:hasBindErrors name="obs">
<openmrs:message htmlEscape="false" code="fix.error"/>
<div class="error">
<c:forEach items="${errors.globalErrors}" var="error">
<openmrs:message code="${error.defaultMessage}" text="${error.defaultMessage}"/><br/><!-- ${error} -->
</c:forEach>
</div>
<br/>
<openmrs_tag:errorNotify errors="${errors}" />
</spring:hasBindErrors>

<c:if test="${obs.voided}">
Expand Down
Expand Up @@ -409,12 +409,7 @@ function generateMergeList(){
</style>

<spring:hasBindErrors name="patient">
<openmrs:message htmlEscape="false" code="fix.error"/>
<div class="error">
<c:forEach items="${errors.allErrors}" var="error">
<openmrs:message code="${error.code}" text="${error.code}"/><br/><!-- ${error} -->
</c:forEach>
</div>
<openmrs_tag:errorNotify errors="${errors}" />
</spring:hasBindErrors>

<h2><openmrs:message code="Patient.merge.title"/></h2>
Expand Down
Expand Up @@ -286,12 +286,7 @@
</openmrs:hasPrivilege>

<spring:hasBindErrors name="patient">
<openmrs:message htmlEscape="false" code="fix.error"/>
<div class="error">
<c:forEach items="${errors.allErrors}" var="error">
<openmrs:message code="${error.code}" text="${error.code}" arguments="${error.arguments}"/><br/><!-- ${fn:replace(error, '--', '\\-\\-')} -->
</c:forEach>
</div>
<openmrs_tag:errorNotify errors="${errors}" />
</spring:hasBindErrors>

<form method="post" onSubmit="removeBlankData()">
Expand Down
Expand Up @@ -221,12 +221,7 @@
<openmrs:globalProperty key="use_patient_attribute.mothersName" defaultValue="false" var="showMothersName"/>

<spring:hasBindErrors name="patientModel">
<openmrs:message htmlEscape="false" code="fix.error"/>
<div class="error">
<c:forEach items="${errors.allErrors}" var="error">
<openmrs:message code="${error.code}" text="${error.code}" arguments="${error.arguments}"/><br/><!-- ${fn:replace(error, '--', '\\-\\-')} -->
</c:forEach>
</div>
<openmrs_tag:errorNotify errors="${errors}" />
</spring:hasBindErrors>

<form:form method="post" action="shortPatientForm.form" onsubmit="removeHiddenRows()" modelAttribute="patientModel">
Expand Down
Expand Up @@ -263,12 +263,7 @@
</openmrs:hasPrivilege>

<spring:hasBindErrors name="person">
<openmrs:message htmlEscape="false" code="fix.error"/>
<div class="error">
<c:forEach items="${errors.allErrors}" var="error">
<openmrs:message code="${error.code}" text="${error.code}" arguments="${error.arguments}"/><br/><!-- ${fn:replace(error, '--', '\\-\\-')} -->
</c:forEach>
</div>
<openmrs_tag:errorNotify errors="${errors}" />
</spring:hasBindErrors>

<form method="post" onSubmit="removeBlankData()">
Expand Down
10 changes: 2 additions & 8 deletions webapp/src/main/webapp/WEB-INF/view/admin/scheduler/schedulerForm.jsp 100755 → 100644
Expand Up @@ -142,17 +142,11 @@ window.onload = init;


<spring:hasBindErrors name="concept">
<openmrs:message htmlEscape="false" code="fix.error"/>
<div class="error">
<c:forEach items="${errors.allErrors}" var="error">
<openmrs:message code="${error.code}" text="${error.code}"/><br/><!-- ${error} -->
</c:forEach>
</div>
<br />
<openmrs_tag:errorNotify errors="${errors}" />
</spring:hasBindErrors>

<spring:hasBindErrors name="task">
<openmrs:message htmlEscape="false" code="fix.error"/>
<div class="error"><openmrs:message code="fix.error"/></div>
<br />
</spring:hasBindErrors>

Expand Down
7 changes: 1 addition & 6 deletions webapp/src/main/webapp/WEB-INF/view/admin/users/alertForm.jsp 100755 → 100644
Expand Up @@ -140,12 +140,7 @@
<h2><openmrs:message code="Alert.manage.title"/></h2>

<spring:hasBindErrors name="alert">
<openmrs:message htmlEscape="false" code="fix.error"/>
<div class="error">
<c:forEach items="${errors.allErrors}" var="error">
<openmrs:message code="${error.code}" text="${error.code}"/><br/><!-- ${error} -->
</c:forEach>
</div>
<openmrs_tag:errorNotify errors="${errors}" />
</spring:hasBindErrors>

<form method="post">
Expand Down
Expand Up @@ -16,13 +16,7 @@
</c:if>

<spring:hasBindErrors name="user">
<openmrs:message htmlEscape="false" code="fix.error"/>
<div class="error">
<c:forEach items="${errors.allErrors}" var="error">
<openmrs:message code="${error.code}" text="${error.code}"/><br/><!-- ${error} -->
</c:forEach>
</div>
<br />
<openmrs_tag:errorNotify errors="${errors}" />
</spring:hasBindErrors>

<form id="thisChangePasswordForm" method="post" action="changePassword.form" autocomplete="off">
Expand Down
7 changes: 1 addition & 6 deletions webapp/src/main/webapp/WEB-INF/view/admin/users/roleForm.jsp
Expand Up @@ -44,12 +44,7 @@
<h2><openmrs:message code="Role.manage.title"/></h2>

<spring:hasBindErrors name="role">
<openmrs:message htmlEscape="false" code="fix.error"/>
<div class="error">
<c:forEach items="${errors.allErrors}" var="error">
<openmrs:message code="${error.code}" text="${error.code}"/><br/><!-- ${error} -->
</c:forEach>
</div>
<openmrs_tag:errorNotify errors="${errors}" />
</spring:hasBindErrors>

<form method="post">
Expand Down
8 changes: 1 addition & 7 deletions webapp/src/main/webapp/WEB-INF/view/admin/users/userForm.jsp 100755 → 100644
Expand Up @@ -64,13 +64,7 @@
</c:if>

<spring:hasBindErrors name="user">
<openmrs:message htmlEscape="false" code="fix.error"/>
<div class="error">
<c:forEach items="${errors.allErrors}" var="error">
<openmrs:message code="${error.code}" text="${error.code}"/><br/><!-- ${error} -->
</c:forEach>
</div>
<br />
<openmrs_tag:errorNotify errors="${errors}" />
</spring:hasBindErrors>

<form id="thisUserForm" method="post" action="user.form" autocomplete="off">
Expand Down
Expand Up @@ -104,13 +104,7 @@ $j(document).ready( function() {
</style>

<spring:hasBindErrors name="visit">
<openmrs:message htmlEscape="false" code="fix.error"/>
<div class="error">
<c:forEach items="${errors.allErrors}" var="error">
<openmrs:message code="${error.code}" text="${error.code}" arguments="${error.arguments}"/><br/>
</c:forEach>
</div>
<br />
<openmrs_tag:errorNotify errors="${errors}" />
</spring:hasBindErrors>

<h2>
Expand Down
Expand Up @@ -198,13 +198,7 @@
</c:if>

<spring:hasBindErrors name="command">
<openmrs:message htmlEscape="false" code="fix.error"/>
<div class="error">
<c:forEach items="${errors.allErrors}" var="error">
<openmrs:message code="${error.code}" text="${error.code}"/><br/><!-- ${error} -->
</c:forEach>
</div>
<br />
<openmrs_tag:errorNotify errors="${errors}" />
</spring:hasBindErrors>

<c:if test="${command.concept.conceptId != null}">
Expand Down
8 changes: 1 addition & 7 deletions webapp/src/main/webapp/WEB-INF/view/optionsForm.jsp
Expand Up @@ -121,13 +121,7 @@ function containsError(element) {
<h2><openmrs:message code="options.title" /></h2>

<spring:hasBindErrors name="opts">
<openmrs:message htmlEscape="false" code="fix.error" />
<div class="error"><c:forEach items="${errors.allErrors}" var="error">
<openmrs:message code="${error.code}" text="${error.code}" />
<br />
<!-- ${error} -->
</c:forEach></div>
<br />
<openmrs_tag:errorNotify errors="${errors}" />
</spring:hasBindErrors>

<form method="post">
Expand Down

0 comments on commit ba6641f

Please sign in to comment.