Browse Source

Improved user validation on client to make sure they enter a username.

pull/11/head
Jeffery Russell 5 years ago
parent
commit
457eb65aa7
1 changed files with 23 additions and 7 deletions
  1. +23
    -7
      public/GraphGenerator.html

+ 23
- 7
public/GraphGenerator.html View File

@ -123,27 +123,43 @@
<script> <script>
function fetchUserInput() { function fetchUserInput() {
const inputedName = $("#txtUsername").val(); const inputedName = $("#txtUsername").val();
if(inputedName === "")
{
alert("Please enter a Github name in the text field.")
}
return inputedName; return inputedName;
} }
function fetchOrgInput() {
function fetchOrgInput()
{
const inputedOrg = $("#txtOrgname").val(); const inputedOrg = $("#txtOrgname").val();
if(inputedOrg === "")
{
alert("Please enter a Github organization name in the text field.")
}
return inputedOrg; return inputedOrg;
} }
function toFriends() {
function toFriends()
{
var uname = fetchUserInput(); var uname = fetchUserInput();
window.location.href = "./FriendsGraph.html?name=" + uname;
if(uname !== "")
window.location.href = "./FriendsGraph.html?name=" + uname;
} }
function toTimeline() {
function toTimeline()
{
var uname = fetchUserInput(); var uname = fetchUserInput();
window.location.href = "./TimeLineGraph.html?name=" + uname;
if(uname !== "")
window.location.href = "./TimeLineGraph.html?name=" + uname;
} }
function toOrgRepos() { function toOrgRepos() {
var oname = fetchOrgInput();
window.location.href = "./OrgRepoGraph.html?name=" + oname;
var uname = fetchOrgInput();
if(uname !== "")
window.location.href = "./OrgRepoGraph.html?name=" + uname;
} }
</script> </script>

Loading…
Cancel
Save