Need help creating JQuery dialog on the tableview page
Posted: 2025-03-01 03:48
On my inspection-tv.js page I added a button that I want to use to open a JQuery UI dialog while on the inspections-tv.php page for the user to enter a date range before proceeding on to a fpdf report i created that needs the dates as input. I created a separate page, daterange.php, just to experiment with creating the dialog and the code in that page is listed below. I also have included the code I use to create the "Failure Report" button on the inspections-tv.js page; at the moment i have the button sending the user to the daterange.php page just to see if the button works.
How can I accomplish this?
TD
inspections-tv.js
daterange.php
How can I accomplish this?
TD
inspections-tv.js
Code: Select all
// add print failure report button
$j(function(){
$j("#NoFilter").after('<button class="btn btn-default" type="button" id="failures">Failure Report</button>');
$j('button[id=failures]').click(function(){
window.location = 'hooks/daterange.php';
});
});
Code: Select all
<!DOCTYPE html><html lang="en"><head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>jQuery UI Datepicker - Default functionality</title>
<link rel="stylesheet" href="https://code.jquery.com/ui/1.14.1/themes/base/jquery-ui.css">
<link rel="stylesheet" href="/resources/demos/style.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css">
<script src="https://code.jquery.com/jquery-3.7.1.js"></script>
<script src="https://code.jquery.com/ui/1.14.1/jquery-ui.js"></script>
<script>
$( function(){
$( "#dateFrom" ).datepicker();
$( "#dateTo" ).datepicker();
$( "#dialog" ).dialog();
$( "#dialog" ).dialog({ title: "Select Date Range"});
$( "#dialog" ).dialog({ height: 250, width: 325 });
});
</script>
<style>
p {
float: right;
}
input {
float: right;
}
button {
margin-left:auto;
margin-right:auto;
}
</style>
</head>
<body>
<div id="dialog">
<br>
<form >
<p>FROM:  <input type="text" class="form-inline" id="dateFrom" style="text-align:center;"></p>
<br>
<br>
<p>TO:  <input type="text" class="form-inline" id="dateTo" style="text-align:center;"></p>
<br>
<br>
<button type="button" class="btn border border-dark" onclick="js:alert('Dialog Button Test')"> OK </button>
</form>
</div>
</body></html>
<?php
?>