Message
Message
Message
DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- CSS only -->
<link
href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"
rel="stylesheet"
integrity="sha384-
1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3"
crossorigin="anonymous">
<!-- JavaScript Bundle with Popper -->
<script
src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"
integrity="sha384-
ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p"
crossorigin="anonymous"></script>
<title>Document</title>
<script>
function validateId(){
var id = document.getElementById('inputid').value;
function validateAge(){
var age = document.getElementById('inputage').value;
function validateType(){
var type = document.getElementById('inputselect').value;
function validateDate(){
var date = document.getElementById('inputdate').value;
function Validate(){
if(validateId() && validateName() && validateAge() && validateType() &&
validateDate()){
var id = document.getElementById('inputid').value;
var name = document.getElementById('inputname').value;
var age = document.getElementById('inputage').value;
var type = document.getElementById('inputselect').value;
var date = document.getElementById('inputdate').value;
var x = 0;
let obj = {
pid:id,
pname:name,
page:age,
ptype:type,
regdate:date
}
arr.push(obj);
}
}
function DisplayAll(){
console.log(arr)
}
</script>
</head>
<body>
<div class="container mt-5 w-50">
<form>
<div class="mb-3 row">
<label class="col-sm-2 col-form-label">Patient id</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="inputid">
<span id="s1" style="color:red"></span>
</div>
</div>
<div class="mb-3 row">
<label class="col-sm-2 col-form-label">Patient Name</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="inputname">
<span id="s2" style="color:red"></span>
</div>
</div>
<div class="mb-3 row">
<label class="col-sm-2 col-form-label">Patient Age</label>
<div class="col-sm-10">
<input type="number" class="form-control" id="inputage">
<span id="s3" style="color:red"></span>
</div>
</div>
<div class="mb-3 row">
<label class="col-sm-2 col-form-label">Patient Type</label>
<div class="col-sm-10">
<select class="form-select" aria-label="Default select example"
id="inputselect">
<option selected>-- select --</option>
<option value="In Patient">In Patient</option>
<option value="Out Patient">Out Patient</option>
</select>
<span id="s4" style="color:red"></span>
</div>
</div>
<div class="mb-3 row">
<label class="col-sm-2 col-form-label">Registration Date</label>
<div class="col-sm-10">
<input type="date" class="form-control" id="inputdate">
<span id="s5" style="color:red"></span>
</div>
</div>
<div>
<button type="button" class="btn btn-dark" onClick="Validate()">Add
Details</button>
<button type="button" class="btn btn-dark" onClick="DisplayAll()">Show
All Details</button>
</div>
</form>
</div>
</body>
</html>