|  | @@ -2,6 +2,12 @@
 | 
	
		
			
				|  |  |  	pageEncoding="UTF-8"%>
 | 
	
		
			
				|  |  |  <%@ taglib prefix="s" uri="/struts-tags"%>
 | 
	
		
			
				|  |  |  <%@ taglib prefix="tag" tagdir="/WEB-INF/tags" %>
 | 
	
		
			
				|  |  | +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
 | 
	
		
			
				|  |  | +<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +<c:set var="req" value="${pageContext.request}" />
 | 
	
		
			
				|  |  | +<c:set var="url">${req.requestURL}</c:set>
 | 
	
		
			
				|  |  | +<c:set var="base" value="${fn:substring(url, 0, fn:length(url) - fn:length(req.requestURI))}${req.contextPath}/" />
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  <!DOCTYPE html>
 | 
	
		
			
				|  |  |  <html>
 | 
	
	
		
			
				|  | @@ -24,7 +30,7 @@
 | 
	
		
			
				|  |  |          </div>
 | 
	
		
			
				|  |  |          <div class="row">
 | 
	
		
			
				|  |  |          	<s:debug />
 | 
	
		
			
				|  |  | -            <s:form action="inscription" validate="true" class="col s12">
 | 
	
		
			
				|  |  | +            <s:form action="inscription" validate="true" class="col s12" autocomplete="off">
 | 
	
		
			
				|  |  |                  <div class="row">
 | 
	
		
			
				|  |  |                      <div class="input-field col m6 s12">
 | 
	
		
			
				|  |  |                      	<i class="material-icons prefix">person</i>
 | 
	
	
		
			
				|  | @@ -59,7 +65,7 @@
 | 
	
		
			
				|  |  |                  <div class="row">
 | 
	
		
			
				|  |  |                      <div class="input-field col m6 s12">
 | 
	
		
			
				|  |  |                          <i class="material-icons prefix">location_city</i>
 | 
	
		
			
				|  |  | -                        <s:textfield id="ville" name="ville" class="validate"  required="required" />
 | 
	
		
			
				|  |  | +                        <s:textfield id="ville" name="ville" class="validate autocomplete"  required="required" />
 | 
	
		
			
				|  |  |                          <label for="ville">Ville*</label>
 | 
	
		
			
				|  |  |                          <span class="helper-text"></span>
 | 
	
		
			
				|  |  |                          <s:fielderror fieldName="ville" class="field-error hide" />
 | 
	
	
		
			
				|  | @@ -127,9 +133,23 @@
 | 
	
		
			
				|  |  |      	$(document).ready(() => {
 | 
	
		
			
				|  |  |      		const loader = M.Modal.getInstance($('#loader'));
 | 
	
		
			
				|  |  |      		
 | 
	
		
			
				|  |  | -    		$('#btn-valid').on('click', function() {
 | 
	
		
			
				|  |  | -    			loader.open();
 | 
	
		
			
				|  |  | -    		});
 | 
	
		
			
				|  |  | +    		// Chargement autcomplete
 | 
	
		
			
				|  |  | +    		loader.open();
 | 
	
		
			
				|  |  | +    		$.ajax({
 | 
	
		
			
				|  |  | +                type: "GET",
 | 
	
		
			
				|  |  | +                url: "${base}api/ville/list/all/autocomplete",
 | 
	
		
			
				|  |  | +                error: () => {
 | 
	
		
			
				|  |  | +                	loader.close();
 | 
	
		
			
				|  |  | +					console.error("Impossible de charger l'autocomplete");
 | 
	
		
			
				|  |  | +                },
 | 
	
		
			
				|  |  | +                success: (result) => {
 | 
	
		
			
				|  |  | +                	loader.close();
 | 
	
		
			
				|  |  | +                	$('input.autocomplete').autocomplete({
 | 
	
		
			
				|  |  | +                		data: result.data,
 | 
	
		
			
				|  |  | +                		limit: 5
 | 
	
		
			
				|  |  | +                	});
 | 
	
		
			
				|  |  | +                },
 | 
	
		
			
				|  |  | +            });
 | 
	
		
			
				|  |  |      	});
 | 
	
		
			
				|  |  |      </script>
 | 
	
		
			
				|  |  |  </body>
 |