* dynamic validation

* small fixes

* remove set property

* fix conflicts

* fix conflicts

* add optional
This commit is contained in:
lor6
2017-04-14 08:14:44 +03:00
committed by Grzegorz Piwowarek
parent a5879bf8b7
commit 2b8ba178e4
5 changed files with 15 additions and 56 deletions
@@ -43,4 +43,6 @@ servlet.mapping=/dispatcherExampleURL
#banner.image.width= //TODO
#banner.image.height= //TODO
#banner.image.margin= //TODO
#banner.image.invert= //TODO
#banner.image.invert= //TODO
contactInfoType=email
@@ -3,39 +3,14 @@
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Customer Page</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.0/jquery.min.js"></script>
<script>
$(document).ready(function() {
$.ajax({
url: "contactInfoTypes"
}).done(function(data) {
var contactInfoType = $('#contactInfoType').text();
$.each(data,function(key, value) {
var o = new Option(value.type, value.type);
if (value.type == contactInfoType) {
o.selected = true;
}
$('#expressions').append(o);
});
});
$('#expressions').change(function(){
$.ajax({
url: "updateContactInfoType",
method:'POST',
data:{type:$('#expressions').val()}
});
});
});
</script>
</head>
<body>
<br />
<form action="customer" method="POST">
Contact Info: <input type="text" name="contactInfo" /> <br />
Contact Info Type: <select id="expressions" ></select> <br />
<input type="submit" value="Submit" />
</form>
<br /><br />
<span th:text="${message}"></span><br />
<span id="contactInfoType" th:text="${contactInfoType}" style="visibility:hidden"></span><br />
</body>
</html>