Downloads Documentation Community Contribute Demo






Show Sidebar
Login | Register
Show
Ignore:
Timestamp:
08/18/08 12:05:28 (5 months ago)
Author:
machosry
Message:

address hierarchy: done with newPatientForm and patientDashboard yet to fix the drop down in patient.form

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • openmrs-modules/addresshierarchy/web/module/portlets/addressLayout.jsp

    r5288 r5302  
    1 <%@ include file="/WEB-INF/template/include.jsp" %> 
    2  
    3 <c:if test="${model.authenticatedUser != null}"> 
    4         <c:choose> 
    5                 <c:when test="${model.size == 'columnHeaders'}"> 
    6                         <c:if test="${model.layoutShowExtended == 'true'}"> 
    7                                 <th></th> 
    8                         </c:if> 
    9                          
    10                         <c:forEach items="${model.layoutTemplate.lines}" var="line"> 
    11                                 <c:forEach items="${line}" var="token"> 
    12                                         <c:if test="${token.isToken == model.layoutTemplate.layoutToken}"> 
    13                                                 <th><spring:message code="${token.displayText}"/></th> 
    14                                         </c:if> 
    15                                 </c:forEach> 
    16                         </c:forEach>     
    17                 </c:when> 
    18  
    19                 <c:when test="${model.size == 'inOneRow'}"> 
    20                         <tr> 
    21                                 <c:if test="${model.layoutShowExtended == 'true'}"> 
    22                                         <td> 
    23                                                 <spring:bind path="preferred"> 
    24                                                         <c:if test="${status.value}">*</c:if> 
    25                                                 </spring:bind> 
    26                                         </td> 
    27                                 </c:if> 
    28                                 <c:forEach items="${model.layoutTemplate.lines}" var="line"> 
    29                                         <c:forEach items="${line}" var="token"> 
    30                                                 <c:if test="${token.isToken == model.layoutTemplate.layoutToken}"> 
    31                                                         <td> 
    32                                                                 <spring:bind path="${token.codeName}"> 
    33                                                                         ${status.value} 
    34                                                                 </spring:bind> 
    35                                                         </td> 
    36                                                 </c:if> 
    37                                         </c:forEach> 
    38                                 </c:forEach>     
    39                         </tr> 
    40                 </c:when> 
    41                 <c:when test="${model.size == 'compact'}"> 
    42                         <div id="${model.portletDivName}"> 
    43                                 <table> 
    44                                         <c:forEach items="${model.layoutTemplate.lines}" var="line"> 
    45                                                 <tr> 
    46                                                         <td> 
    47                                                                 <c:forEach items="${line}" var="token"> 
    48                                                                         <c:if test="${token.isToken == model.layoutTemplate.layoutToken}"> 
    49                                                                                 <spring:bind path="${token.codeName}"> 
    50                                                                                         ${status.value} 
    51                                                                                 </spring:bind> 
    52                                                                         </c:if> 
    53                                                                         <c:if test="${token.isToken == model.layoutTemplate.nonLayoutToken}"> 
    54                                                                                 ${token.displayText} 
    55                                                                         </c:if> 
    56                                                                 </c:forEach> 
    57                                                         </td> 
    58                                                 </tr> 
    59                                         </c:forEach> 
    60                                 </table> 
    61                         </div> 
    62                 </c:when> 
    63                 <c:when test="${model.size == 'full'}"> 
    64                         <c:choose> 
    65                                 <c:when test="${model.layoutMode == 'view'}"> 
    66                                         <div id="${model.portletDivName}"> 
    67                                                 <table> 
    68                                                         <c:forEach items="${model.layoutTemplate.lines}" var="line"> 
    69                                                                 <tr> 
    70                                                                         <td> 
    71                                                                                 <c:forEach items="${line}" var="token"> 
    72                                                                                         <c:if test="${token.isToken == model.layoutTemplate.layoutToken}"> 
    73                                                                                                 <spring:message code="${token.displayText}" />: 
    74                                                                                                 <spring:bind path="${token.codeName}"> 
    75                                                                                                         ${status.value} 
    76                                                                                                 </spring:bind> 
    77                                                                                         </c:if> 
    78                                                                                         <c:if test="${token.isToken == model.layoutTemplate.nonLayoutToken}"> 
    79                                                                                                 ${token.displayText} 
    80                                                                                         </c:if> 
    81                                                                                 </c:forEach> 
    82                                                                         </td> 
    83                                                                 </tr> 
    84                                                         </c:forEach> 
    85                                                 </table> 
    86                                         </div> 
    87                                 </c:when> 
    88                                 <c:otherwise> 
    89                                         <c:if test="${model.layoutShowTable != 'false'}"> 
    90                                                 <div id="${model.portletDivName}"> 
    91                                                         <table> 
    92                                         </c:if> 
    93                                         <c:if test="${model.layoutShowExtended == 'true'}"> 
    94                                                         <tr> 
    95                                                                 <td><spring:message code="general.preferred"/></td> 
    96                                                                 <td> 
    97                                                                         <spring:bind path="preferred"> 
    98                                                                                 <input type="hidden" name="_${status.expression}"> 
    99                                                                                 <input type="checkbox" name="${status.expression}" onclick="if (preferredBoxClick) preferredBoxClick(this)" value="true" alt="personAddress" <c:if test="${status.value == true}">checked</c:if> /> 
    100                                                                                 <c:if test="${status.errorMessage != ''}"><span class="error">${status.errorMessage}</span></c:if> 
    101                                                                         </spring:bind> 
    102                                                                 </td> 
    103                                                         </tr> 
    104                                         </c:if> 
    105                                         <c:forEach items="${model.layoutTemplate.lines}" var="line"> 
    106                                                 <tr> 
    107                                                         <c:forEach items="${line}" var="token" varStatus="tokenStatus"> 
    108                                                                 <c:if test="${token.isToken == model.layoutTemplate.layoutToken}"> 
    109                                                                         <td><spring:message code="${token.displayText}" /></td> 
    110                                                                         <td <c:if test="${tokenStatus.last && tokenStatus.index < model.layoutTemplate.maxTokens}">colspan="${model.layoutTemplate.maxTokens - tokenStatus.index}"</c:if>> 
    111                                                                                 <spring:bind path="${token.codeName}"> 
    112                                                                                         <c:if test="${status.value == null}"> 
    113                                                                                                 <input type="text" name="${status.expression}" value="${model.layoutTemplate.elementDefaults[token.codeName]}" size="${token.displaySize}" onfocus="alert(hi)"/> 
    114                                                                                         </c:if> 
    115                                                                                         <c:if test="${status.value != null}"> 
    116                                                                                                 <input type="text" name="${status.expression}" value="${status.value}" size="${token.displaySize}" onfocus="alert(hi)"/> 
    117                                                                                         </c:if> 
    118                                                                                         <c:if test="${model.layoutShowErrors != 'false'}"> 
    119                                                                                                 <c:if test="${status.errorMessage != ''}"><span class="error">${status.errorMessage}</span></c:if> 
    120                                                                                         </c:if> 
    121                                                                                 </spring:bind> 
    122                                                                         </td> 
    123                                                                 </c:if> 
    124                                                         </c:forEach> 
    125                                                 </tr> 
    126                                         </c:forEach> 
    127                                         <c:if test="${model.layoutShowExtended == 'true'}"> 
    128                                                         <spring:bind path="creator"> 
    129                                                                 <c:if test="${!(status.value == null)}"> 
    130                                                                         <tr> 
    131                                                                                 <td><spring:message code="general.createdBy" /></td> 
    132                                                                                 <td colspan="4"> 
    133                                                                                         ${status.value.personName} - 
    134                                                                                         <openmrs:formatDate path="dateCreated" type="long" /> 
    135                                                                                 </td> 
    136                                                                         </tr> 
    137                                                                 </c:if> 
    138                                                         </spring:bind> 
    139                                                         <tr> 
    140                                                                 <td><spring:message code="general.voided"/></td> 
    141                                                                 <td> 
    142                                                                         <spring:bind path="voided"> 
    143                                                                                 <input type="hidden" name="_${status.expression}"/> 
    144                                                                                 <input type="checkbox" name="${status.expression}"  
    145                                                                                            <c:if test="${status.value == true}">checked="checked"</c:if>  
    146                                                                                            onClick="toggleLayer('<spring:bind path="personAddressId">voidReasonRow-${status.value}</spring:bind>'); if (voidedBoxClicked) voidedBoxClicked(this); " 
    147                                                                                 /> 
    148                                                                         </spring:bind> 
    149                                                                 </td> 
    150                                                         </tr> 
    151                                                         <tr id="<spring:bind path="personAddressId">voidReasonRow-${status.value}</spring:bind>" 
    152                                                                 style="<spring:bind path="voided"><c:if test="${status.value == false}">display: none;</c:if></spring:bind>"> 
    153                                                                 <td><spring:message code="general.voidReason"/></td> 
    154                                                                 <spring:bind path="voidReason"> 
    155                                                                         <td colspan="4"> 
    156                                                                                 <input type="text" name="${status.expression}" value="${status.value}" size="43" /> 
    157                                                                                 <c:if test="${status.errorMessage != ''}"><span class="error">${status.errorMessage}</span></c:if> 
    158                                                                         </td> 
    159                                                                 </spring:bind> 
    160                                                         </tr> 
    161                                                         <spring:bind path="voidedBy"> 
    162                                                                 <c:if test="${!(status.value == null)}"> 
    163                                                                         <tr> 
    164                                                                                 <td><spring:message code="general.voidedBy" /></td> 
    165                                                                                 <td colspan="4"> 
    166                                                                                         ${status.value.personName} - 
    167                                                                                         <openmrs:formatDate path="dateVoided" type="long" /> 
    168                                                                                 </td> 
    169                                                                         </tr> 
    170                                                                 </c:if> 
    171                                                         </spring:bind> 
    172                                         </c:if> 
    173                                         <c:if test="${model.layoutShowTable != 'false'}"> 
    174                                                         </table> 
    175                                                 </div> 
    176                                         </c:if> 
    177                                 </c:otherwise> 
    178                         </c:choose> 
    179                 </c:when> 
    180                 <c:otherwise> 
    181                         ERROR! unknown size '${model.size}' in Address portlet 
    182                 </c:otherwise> 
    183         </c:choose> 
    184 </c:if> 
     1 
     2 
     3<%@ include file="/WEB-INF/template/include.jsp"%> 
     4 
     5<style> 
     6.hide{ 
     7 
     8        display:none; 
     9 
     10
     11 
     12</style> 
     13 
     14 
     15 
     16<openmrs:htmlInclude file="/dwr/interface/AddressHierarchy.js"/> 
     17 
     18 
     19 
     20<script type="text/javascript"> 
     21 
     22 
     23function tableBuilder(data){ 
     24         
     25        var list = ["Preferred","Address 1","Address 2","Country","State","Sub Location 1","Sub Location 2","Sub Location 3","Sub Location 4","Sub Location 5","Sub Location 6","Postal Code","Longitude","Latitude"]; 
     26        var output = new Array(); 
     27         
     28        output.push("<table id=\"dashboard\">"); 
     29        output.push("<tr>"); 
     30        for(var j=0;j<list.length;j++){ 
     31                output.push("<th>"+list[j]+"</th>"); 
     32        } 
     33        output.push("</tr>"); 
     34        output.push("<tr>"); 
     35        for(var i = 0; i<data.length;i++){ 
     36                if(data[i]=="true") 
     37                        output.push("<td>*</td>"); 
     38                else if(data[i]=="false") 
     39                        output.push("<td></td>") 
     40                else     
     41                        output.push("<td>"+data[i]+"</td>"); 
     42                if(i!=0){ 
     43                if(i%13 == 0) 
     44                        output.push("</tr><tr>"); 
     45                } 
     46        } 
     47        output.push("</tr>"); 
     48        output.push("</table>"); 
     49         
     50        document.getElementById("tableWrapper").innerHTML=output.join(""); 
     51        document.getElementById("newPatient").parentNode.removeChild(document.getElementById("newPatient")); 
     52        document.getElementById("patientForm").parentNode.removeChild(document.getElementById("patientForm")); 
     53                 
     54
     55 
     56 
     57 
     58 
     59 
     60 
     61function getCountryList(array){ 
     62 
     63        var dummy = new Array(); 
     64 
     65        dummy[0] = "Select One"; 
     66 
     67        var country = dummy.concat(array); 
     68 
     69        DWRUtil.removeAllOptions("country"); 
     70 
     71        DWRUtil.addOptions("country", country); 
     72 
     73        document.getElementById("countryparentid").value = "0"; 
     74        document.getElementById("patientForm").parentNode.removeChild(document.getElementById("patientForm")); 
     75         
     76 
     77
     78 
     79function locFill(data){ 
     80         
     81        var j=0; 
     82        var k=0; 
     83        var list = ["address1","address2","country","stateProvince","countyDistrict","subRegion","region","townshipDivision","cityVillage","neighborhoodCell","postalCode","longitude","latitude"]; 
     84        var name=""; 
     85        for(var i=1;i<data.length;i++){ 
     86 
     87                name = "addresses[0]."+list[k]; 
     88                 
     89                document.getElementsByName(name)[j].value=data[i]; 
     90                 
     91                k++; 
     92                if(i!=0){ 
     93                        if(i%13){ 
     94                                j++; 
     95                                k=0; 
     96                                i++; 
     97                                } 
     98                } 
     99                         
     100                 
     101                } 
     102 
     103        alert("here"); 
     104        document.getElementById("newPatient").parentNode.removeChild(document.getElementById("newPatient")); 
     105
     106 
     107 
     108 
     109function init(){ 
     110 
     111        var loc = window.location.href; 
     112        var locarr = loc.split("/"); 
     113        var temp = locarr[locarr.length - 1]; 
     114        var fin = temp.split("?"); 
     115         
     116        if(fin[0]=="newPatient.form"){ 
     117                 
     118                 
     119                AddressHierarchy.getCountryList(getCountryList); 
     120        } 
     121        else if(fin[0]=="patientDashboard.form"){ 
     122                document.getElementById("newPatient").parentNode.removeChild(document.getElementById("newPatient")); 
     123                document.getElementById("patientForm").parentNode.removeChild(document.getElementById("patientForm")); 
     124                var dumx = fin[1].split("="); 
     125                var dumy = dumx[1].split("&"); 
     126                var patientid = dumy[0]; 
     127                 
     128                AddressHierarchy.getLocation(patientid,tableBuilder); 
     129        } 
     130        else{ 
     131 
     132                var dumx = fin[1].split("="); 
     133                var patientid = dumx[1]; 
     134                AddressHierarchy.getLocation(patientid,locFill); 
     135                document.getElementById("newPatient").parentNode.removeChild(document.getElementById("newPatient")); 
     136                document.getElementById("newPatient").parentNode.removeChild(document.getElementById("newPatient")); 
     137 
     138                 
     139        } 
     140
     141 
     142 
     143 
     144function setComponent(locList){ 
     145 
     146        var paramList = ["","country","state","sublocation1","sublocation2","sublocation3","sublocation4","sublocation5","sublocation6","postalcode","longitude","latitude"]; 
     147 
     148        var locationName = locList[0]; 
     149 
     150        var id = parseInt(locList[1]); 
     151 
     152        for(var i=id+1;i<paramList.length;i++){ 
     153 
     154                document.getElementById(paramList[i]).disabled=true; 
     155 
     156                DWRUtil.removeAllOptions(paramList[i]); 
     157 
     158        } 
     159 
     160        var parentLocationId = locList[2]; 
     161 
     162        var paramName = paramList[locList[3]]; 
     163 
     164        var parentId = paramList[locList[3]]+"parentid"; 
     165 
     166         
     167 
     168        document.getElementById(parentId).value = parentLocationId; 
     169 
     170    var arr = locList.slice(4,locList.length); 
     171 
     172        var dummy = new Array(); 
     173 
     174        dummy[0] = "Select One"; 
     175 
     176        var subArray = dummy.concat(arr); 
     177 
     178        document.getElementById(paramName).disabled=false; 
     179 
     180        DWRUtil.removeAllOptions(paramName); 
     181 
     182    DWRUtil.addOptions(paramName,subArray); 
     183 
     184         
     185 
     186
     187 
     188 
     189 
     190function doIt(){ 
     191 
     192        var arr = [this.typeId,this.parId,this.locationName]; 
     193 
     194        AddressHierarchy.getNextComponent(arr,setComponent); 
     195 
     196
     197 
     198 
     199 
     200function locationSelected(id){ 
     201 
     202        this.typeId = id+""; 
     203 
     204        var list = ["","country","state","sublocation1","sublocation2","sublocation3","sublocation4","sublocation5","sublocation6","postalcode","longitude","latitude"]; 
     205 
     206        var arr=new Array("","country","stateProvince","countyDistrict","subRegion","region","townshipDivision","cityVillage","neighborhoodCell","postalCode","longitude","latitude"); 
     207 
     208         
     209        this.paramName = list[id]; 
     210 
     211        this.locationName = DWRUtil.getValue(paramName); 
     212 
     213        var dumm = "address."+arr[id]; 
     214 
     215        document.getElementById(dumm).value = DWRUtil.getValue(paramName); 
     216 
     217        alert(document.getElementById(dumm).value);  
     218         
     219        parentId=list[id]+"parentid"; 
     220 
     221        this.parId = document.getElementById(parentId).value;  
     222 
     223        this.arrList = [typeId,parId,locationName]; 
     224 
     225        doIt(); 
     226 
     227
     228 
     229function saveValues(){ 
     230 
     231        var arr=new Array("","country","stateProvince","countyDistrict","subRegion","region","townshipDivision","cityVillage","neighborhoodCell","postalCode","longitude","latitude"); 
     232        var finarr = new Array(); 
     233        finarr[0] = document.getElementById("count").value; 
     234        var paramName = ""; 
     235        for(var i=1;i<arr.length;i++){ 
     236                paramName = "address."+arr[i]; 
     237                finarr[i] = document.getElementById(paramName).value; 
     238        } 
     239        alert(finarr); 
     240        AddressHierarchy.processForm(finarr); 
     241         
     242
     243 
     244 
     245window.onload=init(); 
     246 
     247</script> 
     248<form> 
     249 
     250        <table id="newPatient" name="newPatient"> 
     251 
     252                <tr> 
     253                        <th><spring:message code="addresshierarchy.location.address1" /> </th> 
     254                        <td><input type="text" value="" name="address.address1" id="address.address1"></td> 
     255                </tr> 
     256 
     257                <tr> 
     258                        <th><spring:message code="addresshierarchy.location.address2" /> </th> 
     259                        <td><input type="text" value="" name="address.address2" id="address.address2"></td> 
     260                </tr> 
     261 
     262 
     263                <tr> 
     264 
     265                 
     266 
     267                        <th><spring:message code="addresshierarchy.location.country"/></th> 
     268 
     269                        <td> 
     270 
     271                                <select name="country" id="country" onChange="locationSelected(1)"> 
     272 
     273                                <option>Wait...</option> 
     274 
     275                                </select> 
     276 
     277                                 
     278 
     279                        </td> 
     280 
     281                        <td><input name=countryparentid id="countryparentid" class="hide"></td> 
     282                        <td><input type="text" value="" name="address.country" id="address.country" class="hide"></td> 
     283 
     284                        </tr> 
     285 
     286                         
     287 
     288                <tr> 
     289 
     290                        <th><spring:message code="addresshierarchy.location.state"/></th> 
     291 
     292                        <td> 
     293 
     294                        <select name="state" id="state" onchange="locationSelected(2)"></select> 
     295 
     296                         
     297 
     298                        </td> 
     299 
     300                        <td><input name="stateparentid" id="stateparentid" class="hide"></td> 
     301                        <td><input type="text" value="" name="address.stateProvince" id="address.stateProvince" class="hide"></td> 
     302                        </tr> 
     303 
     304                         
     305 
     306                <tr> 
     307 
     308                        <th><spring:message code="addresshierarchy.location.sublocation1"/></th> 
     309 
     310                        <td> 
     311 
     312                        <select name="sublocation1" id="sublocation1" onchange="locationSelected(3)"></select> 
     313 
     314                         
     315 
     316                        </td> 
     317 
     318                        <td><input name="sublocation1parentid" id="sublocation1parentid" class="hide"></td> 
     319                        <td><input type="text" value="" name="address.countyDistrict" id="address.countyDistrict" class="hide"></td> 
     320                         
     321                        </tr> 
     322 
     323                         
     324 
     325                <tr> 
     326 
     327                        <th><spring:message code="addresshierarchy.location.sublocation2"/></th> 
     328 
     329                        <td> 
     330 
     331                        <select name="sublocation2" id="sublocation2" onchange="locationSelected(4)"></select> 
     332 
     333                         
     334 
     335                        </td> 
     336 
     337                        <td><input name="sublocation2parentid" id="sublocation2parentid" class="hide"></td> 
     338                        <td><input type="text" value="" name="address.region" id="address.region" class="hide"></td> 
     339                         
     340                        </tr> 
     341 
     342                         
     343 
     344                <tr>     
     345 
     346                        <th><spring:message code="addresshierarchy.location.sublocation3"/></th> 
     347 
     348                        <td> 
     349 
     350                        <select name="sublocation3" id="sublocation3" onchange="locationSelected(5)"></select> 
     351 
     352                         
     353 
     354                        </td> 
     355 
     356                        <td><input name="sublocation3parentid" id="sublocation3parentid" class="hide"></td> 
     357                        <td><input type="text" value="" name="address.subregion" id="address.subregion" class="hide"></td> 
     358                        </tr> 
     359 
     360                         
     361 
     362                <tr> 
     363 
     364                        <th><spring:message code="addresshierarchy.location.sublocation4"/></th> 
     365 
     366                        <td> 
     367 
     368                        <select name="sublocation4" id="sublocation4" onchange="locationSelected(6)"></select> 
     369 
     370                         
     371 
     372                        </td> 
     373 
     374                        <td><input name="sublocation4parentid" id="sublocation4parentid" class="hide"></td> 
     375                        <td><input type="text" value="" name="address.townshipDivision" id="address.townshipDivision" class="hide"></td> 
     376                        </tr> 
     377 
     378                         
     379 
     380                <tr> 
     381 
     382                        <th><spring:message code="addresshierarchy.location.sublocation5"/></th> 
     383 
     384                        <td> 
     385 
     386                        <select name="sublocation5" id="sublocation5" onchange="locationSelected(7)"></select> 
     387 
     388                         
     389 
     390                        </td> 
     391 
     392                        <td><input name="sublocation5parentid" id="sublocation5parentid" class="hide"></td> 
     393                        <td><input type="text" value="" name="address.cityVillage" id="address.cityVillage" class="hide"></td> 
     394                         
     395                        </tr> 
     396 
     397                                         
     398 
     399                <tr>     
     400 
     401                        <th><spring:message code="addresshierarchy.location.sublocation6"/></th> 
     402 
     403                        <td> 
     404 
     405                        <select name="sublocation6" id="sublocation6" onchange="locationSelected(8)"></select> 
     406 
     407                         
     408 
     409                        </td> 
     410 
     411                        <td><input name="sublocation6parentid" id="sublocation6parentid" class="hide"></td> 
     412                        <td><input type="text" value="" name="address.neighborhoodCell" id="address.neighborhoodCell" class="hide"></td> 
     413                        </tr> 
     414 
     415                         
     416 
     417                <tr> 
     418 
     419                        <th><spring:message code="addresshierarchy.location.postalcode"/></th> 
     420 
     421                        <td> 
     422 
     423                        <select name="postalcode" id="postalcode" onchange="locationSelected(9)"></select> 
     424 
     425                        </td> 
     426 
     427                        <td><input name=postalcodeparentid id="postalcodeparentid" class="hide"></td> 
     428                        <td><input type="text" value="" name="address.postalCode" id="address.postalCode" class="hide"></td> 
     429                        </tr> 
     430 
     431                         
     432 
     433                <tr>     
     434 
     435                        <th><spring:message code="addresshierarchy.location.longitude"/></th> 
     436 
     437                        <td> 
     438 
     439                        <select name="longitude" id="longitude" onchange="locationSelected(10)"></select> 
     440 
     441                        </td> 
     442 
     443                        <td><input name="longitudeparentid" id="longitudeparentid" class="hide"></td> 
     444                        <td><input type="text" value="" name="address.longitude" id="address.longitude" class="hide"></td> 
     445                        </tr> 
     446 
     447                         
     448 
     449                <tr>     
     450 
     451                        <th><spring:message code="addresshierarchy.location.latitude"/></th> 
     452 
     453                        <td> 
     454 
     455                        <select name="latitude" id="latitude"></select> 
     456 
     457                        </td> 
     458 
     459                        <td><input name="latitudeparentid" id="latitudeparentid" class="hide"></td> 
     460                        <td><input type="text" value="" name="address.latitude" id="address.latitude" class="hide"></td> 
     461                        </tr> 
     462 
     463        </table> 
     464 
     465                <table id="patientForm" name="patientForm"> 
     466 
     467                <tr> 
     468                <td>Preferred</td> 
     469                <td> 
     470                <input name="_addresses[0].preferred" type="hidden"> 
     471                <input name="addresses[0].preferred" onclick="if (preferredBoxClick) preferredBoxClick(this)" value="true" alt="personAddress" checked="checked" type="checkbox"> 
     472                </td> 
     473                </tr> 
     474 
     475                <tr> 
     476                        <th><spring:message code="addresshierarchy.location.address1" /> </th> 
     477                        <td><input type="text" value="" name="addresses[0].address1" id="addresses[0].address1"></td> 
     478                </tr> 
     479 
     480                <tr> 
     481                        <th><spring:message code="addresshierarchy.location.address2" /> </th> 
     482                        <td><input type="text" value="" name="addresses[0].address2" id="addresses[0].address2"></td> 
     483                </tr> 
     484 
     485 
     486                <tr> 
     487 
     488                 
     489 
     490                        <th><spring:message code="addresshierarchy.location.country"/></th> 
     491                         
     492                        <td><input type="text" value="" name="addresses[0].country" id="addresses[0].country"></td> 
     493 
     494                        </tr> 
     495 
     496                         
     497 
     498                <tr> 
     499 
     500                        <th><spring:message code="addresshierarchy.location.state"/></th> 
     501                         
     502                        <td><input type="text" value="" name="addresses[0].stateProvince" id="addresses[0].stateProvince"></td> 
     503                        </tr> 
     504 
     505                         
     506 
     507                <tr> 
     508 
     509                        <th><spring:message code="addresshierarchy.location.sublocation1"/></th> 
     510                         
     511                        <td><input type="text" value="" name="addresses[0].countyDistrict" id="addresses[0].countyDistrict"></td> 
     512                         
     513                        </tr> 
     514 
     515                         
     516 
     517                <tr> 
     518 
     519                        <th><spring:message code="addresshierarchy.location.sublocation2"/></th> 
     520                         
     521                        <td><input type="text" value="" name="addresses[0].region" id="addresses[0].region"></td> 
     522                         
     523                        </tr> 
     524 
     525                         
     526 
     527                <tr>     
     528 
     529                        <th><spring:message code="addresshierarchy.location.sublocation3"/></th> 
     530                         
     531                        <td><input type="text" value="" name="addresses[0].subregion" id="addresses[0].subregion"></td> 
     532                        </tr> 
     533 
     534                         
     535 
     536                <tr> 
     537