JSFiddle - React, Tailwind, and code Playground
HTML
@{
string pn = Request.Form["pn"];
if (!string.IsNullOrEmpty(pn)) { // This is NOT true the first time the user loads this page
var db123 = Database.Open("DIALER");
var query123 = db123.Query ("Exec sp_AddPNtoDNC " + pn );
}
else {
pn = "";
}
<script>
var pn = '@(pn)';
</script>
}
<!DOCTYPE html>
<script>
function submitDNC(event) {
var valid = false;
alert('Hello world');
// your validation logic goes here, sets valid to TRUE if it's valid
if(!valid) {
event.preventDefault();
}
}
document.getElementById('addDNCform').addEventListener( 'submit', submitDNC, false );
</script>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Add Number to DNC</title>
<link rel="stylesheet" href="normalize.css" />
</head>
<body>
<div id="header">
<h3>Add Phone Number to Dialer Do Not Call List</h3>
</div>
<div id="add-number">
<form action="add-another-number-to-dnc.cshtml" method="post" id="addDNCform">
<h4>Enter 10-digit phone number without dashes, dots or parenthesis</h4>
<input type="text" name="pn" required placeholder="phone number"
title="Phone Number to Add to Do-Not-Call List"
onkeypress="if (event.keyCode == 13) document.getElementById('btnVldt').click()"/> <!-- all this is to treat [Enter] as a click -->
<input id="btnVldt" type="button" value="Add Number to Do Not Call list" onclick="return submitDNC()"/>
</form>
</div>
<div id="result">
<script>
if (pn.length > 0) {
document.getElementById("result").innerHTML=
"<p><b>Phone number " + pn + " was added to the Dialer Do Not Call list.</b></p>" +
"<p>You can...