Skip to content
Snippets Groups Projects
Commit 36b00fd1 authored by Fadhil Imam Kurnia's avatar Fadhil Imam Kurnia
Browse files

Add validation in location edit

parent 32c43c67
Branches
1 merge request!5Complete Bonus in profil and edit location page
...@@ -7,5 +7,14 @@ function validateProfileEdit() { ...@@ -7,5 +7,14 @@ function validateProfileEdit() {
return false; return false;
} }
return true;
}
function validateLocationEdit() {
var input = document.getElementById('locationInput').value;
if (input.trim() == "") {
alert('Location is empty!');
return false;
}
return true; return true;
} }
\ No newline at end of file
...@@ -58,8 +58,8 @@ ...@@ -58,8 +58,8 @@
<div class="row"> <div class="row">
<div class="col-1"></div> <div class="col-1"></div>
<div class="col-4"> <div class="col-4">
<form action="/main/profil/location/add?u=<?=$id?>" method="post"> <form action="/main/profil/location/add?u=<?=$id?>" method="post" onsubmit="return validateLocationEdit()">
<input type="text" name="location" style="width:76%;height: 30px; font-size: medium"> <input id="locationInput" type="text" name="location" style="width:76%;height: 30px; font-size: medium">
<input class="btn green" type="submit" value="ADD" style="width:20%;margin-left: 10px"> <input class="btn green" type="submit" value="ADD" style="width:20%;margin-left: 10px">
</form> </form>
</div> </div>
...@@ -76,5 +76,6 @@ ...@@ -76,5 +76,6 @@
</div> </div>
</div> </div>
</div> </div>
<script type="text/javascript" src="/profil_edit.js"></script>
</body> </body>
</html> </html>
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment