655 lines
25 KiB
PHP
655 lines
25 KiB
PHP
<!-- Body page content -->
|
|
|
|
<link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
|
|
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
|
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
|
|
|
|
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
|
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
|
|
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
|
|
|
|
|
<script type="text/javascript" src="<?php echo base_url(); ?>/assets/jquery.multi-select.js"></script>
|
|
<script type="text/javascript">
|
|
jQuery(document).ready(function($) {
|
|
$('#people').multiSelect();
|
|
});
|
|
</script>
|
|
<style type="text/css">
|
|
.multi-select-container {
|
|
display: inline-block;
|
|
position: relative;
|
|
width: 100%;
|
|
}
|
|
|
|
.multi-select-menu {
|
|
position: absolute;
|
|
left: 0;
|
|
top: 2em;
|
|
z-index: 1;
|
|
float: left;
|
|
min-width: 100%;
|
|
background: #fff;
|
|
margin: 1em 0;
|
|
border: 1px solid #aaa;
|
|
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
|
|
display: none;
|
|
}
|
|
|
|
.multi-select-menuitem {
|
|
display: block;
|
|
font-size: 0.875em;
|
|
padding: 0.6em 1em 0.6em 30px;
|
|
white-space: nowrap;
|
|
}
|
|
|
|
.multi-select-menuitem--titled:before {
|
|
display: block;
|
|
font-weight: bold;
|
|
content: attr(data-group-title);
|
|
margin: 0 0 0.25em -20px;
|
|
}
|
|
|
|
.multi-select-menuitem--titledsr:before {
|
|
display: block;
|
|
font-weight: bold;
|
|
content: attr(data-group-title);
|
|
border: 0;
|
|
clip: rect(0 0 0 0);
|
|
height: 1px;
|
|
margin: -1px;
|
|
overflow: hidden;
|
|
padding: 0;
|
|
position: absolute;
|
|
width: 1px;
|
|
}
|
|
|
|
.multi-select-menuitem+.multi-select-menuitem {
|
|
padding-top: 0;
|
|
}
|
|
|
|
.multi-select-presets {
|
|
border-bottom: 1px solid #ddd;
|
|
}
|
|
|
|
.multi-select-menuitem input {
|
|
position: absolute;
|
|
margin-top: 0.25em;
|
|
margin-left: -20px;
|
|
}
|
|
|
|
.multi-select-button {
|
|
display: block;
|
|
margin-top: 2px;
|
|
width: 100%;
|
|
max-width: 100% !important;
|
|
font-size: 0.875em;
|
|
padding: 0.85em 0.6em;
|
|
white-space: nowrap;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
vertical-align: -0.5em;
|
|
background-color: #fff;
|
|
border: 1px solid #aaa;
|
|
cursor: default;
|
|
}
|
|
|
|
.multi-select-button:after {
|
|
content: "";
|
|
position: absolute;
|
|
display: inline-block;
|
|
width: 0;
|
|
height: 0;
|
|
border-style: solid;
|
|
border-width: 0.4em 0.4em 0 0.4em;
|
|
border-color: #999 transparent transparent transparent;
|
|
margin-left: 0.4em;
|
|
vertical-align: 0.1em;
|
|
right: 5px;
|
|
top: 17px;
|
|
}
|
|
|
|
.multi-select-container--open .multi-select-menu {
|
|
display: block;
|
|
}
|
|
|
|
.multi-select-container--open .multi-select-button:after {
|
|
border-width: 0 0.4em 0.4em 0.4em;
|
|
border-color: transparent transparent #999 transparent;
|
|
}
|
|
|
|
.multi-select-container--positioned .multi-select-menu {
|
|
/* Avoid border/padding on menu messing with JavaScript width calculation */
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
.multi-select-container--positioned .multi-select-menu label {
|
|
/* Allow labels to line wrap when menu is artificially narrowed */
|
|
white-space: normal;
|
|
}
|
|
|
|
#errMessage {
|
|
color: red;
|
|
}
|
|
</style>
|
|
|
|
|
|
<div class="">
|
|
<div class="page-title">
|
|
<div class="title_left">
|
|
<h3>Add Employee</h3>
|
|
</div>
|
|
</div>
|
|
<div class="clearfix"></div>
|
|
<div class="row">
|
|
<div class="col-md-12 col-sm-12 ">
|
|
|
|
<!-- <div class="x_title">
|
|
|
|
<ul class="nav navbar-right panel_toolbox">
|
|
<li><a class="collapse-link"><i id="chevron" class="fa fa-chevron-up"></i></a></li>
|
|
</li>
|
|
</ul>
|
|
<h6>Add Employee Information</h6>
|
|
<div class="clearfix"></div>
|
|
</div> -->
|
|
<!-- <div class="x_content"> -->
|
|
<br />
|
|
<form id="form" data-parsley-validate class="form-horizontal form-label-left" method="post"
|
|
action="<?php echo base_url();?>Employee/createEmp" enctype="multipart/form-data">
|
|
|
|
<input type="hidden" name="<?php echo $this->security->get_csrf_token_name();?>"
|
|
value="<?php echo $this->security->get_csrf_hash();?>">
|
|
|
|
<div class="x_panel">
|
|
<div class="x_title">
|
|
<h5>Personal Information<a style="color:red;">*</a>
|
|
</div><br />
|
|
|
|
<div class="item form-group">
|
|
|
|
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Name<a
|
|
style="color:red;">*</a> </label>
|
|
<div class="col-md-5 col-sm-5 ">
|
|
<input type="text" id="name" name="name"
|
|
value="<?php if(isset($editData)) { echo $editData->name; } ?>" required="required"
|
|
onkeypress="validateKeyPress(event)" class="form-control ">
|
|
</div>
|
|
|
|
<label class="control-label col-md-1 col-sm-1 " for="email"> Email<a style="color:red;">*</a>
|
|
</label>
|
|
<div class="col-md-5 col-sm-5 ">
|
|
<input id="email" name="email"
|
|
value="<?php if(isset($editData)){ echo $editData->email; } ?>" required="required"
|
|
class="form-control" type="email"
|
|
pattern="[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}"
|
|
oninvalid="setCustomValidity('Enter a Valid E-mail Address.')"
|
|
oninput="setCustomValidity('')" onkeyup="check_if_exists(this.id, this.value, this.name)">
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="item form-group">
|
|
|
|
<label class="control-label col-md-1 col-sm-1 " for="email"> Mobile<a style="color:red;">*</a>
|
|
</label>
|
|
<div class="col-md-5 col-sm-5 ">
|
|
<input id="mobile" name="mobile"
|
|
value="<?php if(isset($editData)) { echo $editData->mobile; } ?>"
|
|
onkeypress="return matchnum(event)" required="required" class="form-control" type="text"
|
|
pattern="[6-9][0-9]{9}" minlength="10" maxlength="10"
|
|
oninvalid="setCustomValidity('cant start with number other than 6,7,8,9 or length must be 10.')"
|
|
oninput="setCustomValidity('')" onkeyup="check_if_exists(this.id, this.value, this.name)">
|
|
</div>
|
|
|
|
<label class="control-label col-md-1 col-sm-1 " for="first-name">Department</label>
|
|
<div class="col-md-5 col-sm-5 ">
|
|
<select id="department" name="department" required="required" class="form-control">
|
|
<option value="">--Select--</option>
|
|
<!-- <option value="<?php if(isset($editData)) { echo $editData->department; } ?>"> -->
|
|
<?php if(isset($assetData)) { echo $editData->department; } ?></option>
|
|
<?php foreach ($departmentData as $key => $value) { ?>
|
|
<option value="<?php echo $value->name; ?>"><?php echo $value->name; ?></option>
|
|
<?php } ?>
|
|
</select>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
<div class="item form-group">
|
|
|
|
<label class="control-label col-md-1 col-sm-1 " for="email">Join date</label>
|
|
<div class="col-md-5 col-sm-5 ">
|
|
<input id="j_date" name="j_date"
|
|
value="<?php if(isset($editData)) { echo $editData->email; } ?>" class="form-control"
|
|
type="text" placeholder="DD-MM-YYYY" onkeypress="validateKeyPress(event)"
|
|
autocomplete="off">
|
|
</div>
|
|
|
|
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Manager</label>
|
|
<div class="col-md-5 col-sm-5 ">
|
|
<select id="manager" name="manager" class="form-control">
|
|
<option value="">--Select--</option>
|
|
<?php foreach ($manager as $key => $value) { ?>
|
|
<option value="<?php echo $value->id;?>"><?php echo $value->name; ?></option>
|
|
<?php } ?>
|
|
</select>
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="item form-group">
|
|
|
|
<label class="control-label col-md-1 col-sm-1 " for="first-name">Marital Status</label>
|
|
<div class="col-md-5 col-sm-5 ">
|
|
<select id="marital_status" name="marital_status" class="form-control">
|
|
<option value="">--Select--</option>
|
|
<option value="single">Single</option>
|
|
<option value="married">Married</option>
|
|
<option value="others">Others</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="item form-group">
|
|
|
|
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Username<a
|
|
style="color:red;">*</a> </label>
|
|
<div class="col-md-3 col-sm-3 ">
|
|
<input type="text" id="user_name" name="user_name" value="" required="required"
|
|
class="form-control" onkeyup="check_if_exists(this.id, this.value, this.name)">
|
|
</div>
|
|
|
|
<label class="control-label col-md-1 col-sm-1 " for="last-name"> Password<a
|
|
style="color:red;">*</a> </label>
|
|
<div class="col-md-3 col-sm-3 ">
|
|
<input type="password" id="password" minlength="8" name="password" value=""
|
|
required="required" class="form-control "
|
|
title="password must have alphabets 
password requires 6 characters minimum">
|
|
<span toggle="#password" id="toggle-password"
|
|
class="fa fa-fw fa-eye field-icon toggle-password"></span>
|
|
</div>
|
|
|
|
<label class="control-label col-md-1 col-sm-1 " for="last-name"> Confirm Password<a
|
|
style="color:red;">*</a> </label>
|
|
<div class="col-md-3 col-sm-3 ">
|
|
<input type="password" id="confirm_password" name="confirm_password" value=""
|
|
required="required" class="form-control ">
|
|
<span id='message'></span><span id='errMessage'></span>
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<!-- ----------------------------------------- -->
|
|
<div class="x_panel">
|
|
<div class="x_title">
|
|
<h5>Emergency Contact </h5>
|
|
<div class="item form-group">
|
|
|
|
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Name</label>
|
|
<div class="col-md-5 col-sm-5 ">
|
|
<input type="text" id="relation_name" name="relation_name"
|
|
value="<?php if(isset($editData)) { echo $editData->name; } ?>"
|
|
onkeypress="validateKeyPress(event)" class="form-control ">
|
|
</div>
|
|
|
|
<label class="control-label col-md-1 col-sm-1 " for="email"> Relationship</label>
|
|
<div class="col-md-5 col-sm-5 ">
|
|
<input id="relationship" name="relationship"
|
|
value="<?php if(isset($editData)) { echo $editData->email; } ?>"
|
|
class="form-control" onkeypress="validateKeyPress(event)" type="text">
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="item form-group">
|
|
|
|
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Mobile</label>
|
|
<div class="col-md-5 col-sm-5 ">
|
|
<input type="text" id="relation_mobile" name="relation_mobile"
|
|
onkeypress="return matchnum(event)"
|
|
value="<?php if(isset($editData)) { echo $editData->name; } ?>"
|
|
class="form-control " pattern="[6-9][0-9]{9}" minlength="10" maxlength="10"
|
|
oninvalid="setCustomValidity('cant start with number other than 6,7,8,9 or length must be 10.')"
|
|
oninput="setCustomValidity('')">
|
|
</div>
|
|
|
|
<label class="control-label col-md-1 col-sm-1 " for="email"> Home Tel</label>
|
|
<div class="col-md-5 col-sm-5 ">
|
|
<input id="relation_tel" name="relation_tel" onkeypress="return matchnum(event)"
|
|
value="<?php if(isset($editData)) { echo $editData->relation_tel; } ?>"
|
|
class="form-control" type="text">
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- ----------------------------------------- -->
|
|
<div class="x_panel">
|
|
<div class="x_title">
|
|
<h5>Address Details</h5>
|
|
</div><br />
|
|
|
|
<div class="item form-group">
|
|
|
|
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Address</label>
|
|
<div class="col-md-5 col-sm-5 ">
|
|
<input type="text" id="address" name="address"
|
|
value="<?php if(isset($editData)) { echo $editData->address; } ?>"
|
|
class="form-control ">
|
|
</div>
|
|
|
|
<label class="control-label col-md-1 col-sm-1 " for="email"> City</label>
|
|
<div class="col-md-5 col-sm-5 ">
|
|
<input id="city" name="city" value="<?php if(isset($editData)) { echo $editData->city; } ?>"
|
|
class="form-control" type="text">
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<!-- <div class="item form-group">
|
|
|
|
<label class="control-label col-md-1 col-sm-1 " for="first-name"> State</label>
|
|
<div class="col-md-5 col-sm-5 ">
|
|
<input type="text" id="state" name="state"
|
|
value="<?php if(isset($editData)) { echo $editData->state; } ?>" class="form-control ">
|
|
</div> -->
|
|
<div class="item form-group">
|
|
<label class="control-label col-md-1 col-sm-1" for="first-name">State</label>
|
|
<div class="col-md-5 col-sm-5">
|
|
<input type="text" id="state" name="state" value="<?php if(isset($editData)) { echo $editData->state; } ?>" class="form-control">
|
|
<span id="stateError" style="color: red;"></span>
|
|
</div>
|
|
</div>
|
|
|
|
<label class="control-label col-md-1 col-sm-1 " for="email"> Pincode</label>
|
|
<div class="col-md-5 col-sm-5 ">
|
|
<input id="pincode" name="pincode" onkeypress="return matchnum(event)"
|
|
value="<?php if(isset($editData)) { echo $editData->pincode; } ?>" class="form-control"
|
|
type="text">
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
<!-- ----------------------------------------------------------------------------------->
|
|
<div class="x_panel">
|
|
<div class="x_title">
|
|
<h5>Additional Information</h5>
|
|
<div class="clearfix"></div>
|
|
</div><br />
|
|
|
|
<div class="item form-group">
|
|
|
|
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Employee Id</label>
|
|
<div class="col-md-5 col-sm-5 ">
|
|
<input type="text" id="employee_id" name="emp_id"
|
|
value="<?php if(isset($editData)) { echo $editData->name; } ?>" class="form-control">
|
|
</div>
|
|
|
|
<label class="control-label col-md-1 col-sm-1 " for="email"> Salary</label>
|
|
<div class="col-md-5 col-sm-5 ">
|
|
<input id="salary" name="salary"
|
|
value="<?php if(isset($editData)) { echo $editData->mobile; } ?>" class="form-control"
|
|
type="text">
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
<div class="item form-group">
|
|
|
|
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Comment</label>
|
|
<div class="col-md-5 col-sm-5 ">
|
|
<input id="comment" name="comment"
|
|
value="<?php if(isset($editData)) { echo $editData->mobile; } ?>" class="form-control"
|
|
type="text">
|
|
</div>
|
|
|
|
|
|
<label class="control-label col-md-1 col-sm-1 " for="email"> Gender</label>
|
|
<div class="col-md-5 col-sm-5 " style="padding:10px;">
|
|
<input type="radio" name="gender" value="male" />Male
|
|
<input type="radio" name="gender" value="female" />Female
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="item form-group">
|
|
|
|
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Photo Upload</label>
|
|
<div class="col-md-5 col-sm-5 ">
|
|
<input type="file" id="image" name="image"
|
|
value="<?php if(isset($editData)) { echo $editData->profile_pic; } ?>"
|
|
class="form-control typeFile" onchange="validateFile(this)"
|
|
accept="image/png, image/jpeg, image/jpg, application/pdf">
|
|
<img class="profilepic__image" style="width: 50%; display: block;padding:10px;" src="">
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
<!-- ----------------------------------------- -->
|
|
<div class="x_panel">
|
|
<div class="x_title">
|
|
<h5>Permission</h5>
|
|
<div class="clearfix"></div>
|
|
</div><br />
|
|
|
|
<div class="item form-group">
|
|
|
|
<label class="control-label col-md-1 col-sm-1 " for="last-name">Modules List</label>
|
|
<div class="col-md-5 col-sm-5 ">
|
|
<select id="people" name="group_id[]" class="form-control select2_multiple" multiple>
|
|
<?php foreach ($get_group_list as $key => $value) { ?>
|
|
<option value="<?php echo $value->id; ?>"><?php echo $value->group_name; ?></option>
|
|
<?php } ?>
|
|
</select>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="x_panel"><br>
|
|
<div class="item form-group">
|
|
<div class="offset-md-8">
|
|
<a href="<?php echo base_url();?>Employee/empList" class="btn btn-secondary">Cancel</a>
|
|
<button id="submit" type="submit" class="btn btn-success">Submit</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- /Body page content -->
|
|
<script>
|
|
function matchnum(event) {
|
|
var charcode;
|
|
|
|
charcode = event.which || event.keyCode;
|
|
|
|
if (charcode >= 48 && charcode <= 57) return true; //only numbers
|
|
return false;
|
|
|
|
}
|
|
|
|
function validateKeyPress(event) {
|
|
var key = event.key;
|
|
var allowedCharacters = /^[A-Za-z.]$/;
|
|
|
|
if (!allowedCharacters.test(key)) {
|
|
event.preventDefault();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
$(document).ready(function() {
|
|
// $('.fa fa-chevron-up').click();
|
|
// setTimeout(() => { $('#chevron1').click(); }, 500);
|
|
});
|
|
|
|
|
|
$(document).on('change', '#image', function() {
|
|
|
|
const file = this.files[0];
|
|
if (file) {
|
|
let reader = new FileReader();
|
|
reader.onload = function(event) {
|
|
$('#image').attr('src', event.target.result);
|
|
$('.profilepic__image').attr('src', event.target.result);
|
|
}
|
|
reader.readAsDataURL(file);
|
|
}
|
|
});
|
|
</script>
|
|
|
|
<script>
|
|
var dateFormat = "dd-mm-yy";
|
|
var fromDateInput = $("#j_date");
|
|
console.log(fromDateInput);
|
|
|
|
fromDateInput.datepicker({
|
|
dateFormat: dateFormat,
|
|
changeYear: true,
|
|
changeMonth: true,
|
|
yearRange: "1990:c",
|
|
maxDate: new Date(),
|
|
onSelect: function(dateText, inst) {
|
|
|
|
}
|
|
});
|
|
|
|
function validateKeyPress(event) {
|
|
var key = event.key;
|
|
var allowedCharacters = /^[A-Za-z._/]$/;
|
|
|
|
if (!allowedCharacters.test(key)) {
|
|
event.preventDefault();
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<script>
|
|
function validateFile(input) {
|
|
const file = input.files[0];
|
|
const allowedExtensions = ["jpg", "jpeg", "png", "pdf"];
|
|
const fileExtension = file.name.split(".").pop().toLowerCase();
|
|
|
|
if (!allowedExtensions.includes(fileExtension)) {
|
|
// Invalid file type
|
|
new PNotify({
|
|
text: 'Invalid file type. Only JPG, JPEG, PNG, and PDF files are allowed.',
|
|
type: 'error',
|
|
styling: 'bootstrap3'
|
|
});
|
|
input.value = "";
|
|
return;
|
|
}
|
|
|
|
if (fileExtension === "pdf") {
|
|
// Preview PDF
|
|
const reader = new FileReader();
|
|
reader.onload = function(e) {
|
|
const pdfObject = `<embed src="${e.target.result}" width="500" height="600" type="application/pdf">`;
|
|
document.getElementById("previewContainer").innerHTML = pdfObject;
|
|
};
|
|
reader.readAsDataURL(file);
|
|
} else {
|
|
// Preview image
|
|
const reader = new FileReader();
|
|
reader.onload = function(e) {
|
|
const imageObject = `<img src="${e.target.result}" alt="Preview" width="500">`;
|
|
document.getElementById("previewContainer").innerHTML = imageObject;
|
|
};
|
|
reader.readAsDataURL(file);
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<script>
|
|
// Get the select element
|
|
var select = document.getElementById("module");
|
|
|
|
// Add event listener to handle checkbox selection
|
|
select.addEventListener("change", function() {
|
|
var selectedOptions = Array.from(this.selectedOptions).map(option => option.value);
|
|
console.log(selectedOptions); // You can perform further operations with the selected values
|
|
});
|
|
</script>
|
|
|
|
<script>
|
|
function check_if_exists(id, value, name) {
|
|
// alert(name);
|
|
// var data = $(this).val();
|
|
$.ajax({
|
|
type:"get",
|
|
url: "<?php echo base_url(); ?>Employee/checkUniqueValue",
|
|
data: { value: value, name: name },
|
|
success:function(response)
|
|
{
|
|
if (response == true)
|
|
{
|
|
new PNotify({
|
|
title: 'Warning',
|
|
text: 'That given details Already Exists',
|
|
styling: 'bootstrap3'
|
|
});
|
|
$("#"+id).val('');
|
|
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
$('#password').keyup(function() {
|
|
if ($('#confirm_password').val() == "") {
|
|
$('#errMessage').html('Please Enter confirm password');
|
|
} else {
|
|
$('#errMessage').html('');
|
|
}
|
|
});
|
|
|
|
$('#confirm_password').keyup(function() {
|
|
if ($('#confirm_password').val() == "") {
|
|
$('#errMessage').html('Please Enter confirm password');
|
|
} else {
|
|
$('#errMessage').html('');
|
|
}
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
</script>
|
|
<script>
|
|
document.getElementById('state').addEventListener('input', function(event) {
|
|
var stateInput = event.target.value;
|
|
var regex = /^[A-Za-z\s]+$/; // Allows only letters and spaces
|
|
|
|
if (!regex.test(stateInput)) {
|
|
// Remove any special characters or numbers
|
|
event.target.value = stateInput.replace(/[^A-Za-z\s]/g, '');
|
|
}
|
|
});
|
|
|
|
</script>
|
|
<script>
|
|
document.getElementById('city').addEventListener('input', function(event) {
|
|
var cityInput = event.target.value;
|
|
var regex = /^[A-Za-z\s]+$/; // Allows only letters and spaces
|
|
|
|
if (!regex.test(cityInput)) {
|
|
// Remove any special characters or numbers
|
|
event.target.value = cityInput.replace(/[^A-Za-z\s]/g, '');
|
|
}
|
|
});
|
|
|
|
</script>
|