-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
A lot added into the Profile Settings Page.
- Loading branch information
Showing
3 changed files
with
161 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
//event listener on the apply changes button | ||
document.getElementById('apply').addEventListener('click',applyChanges); | ||
document.getElementById('inputName').addEventListener('keyup',checkEmpty); | ||
document.getElementById('inputSSO').addEventListener('keyup',checkEmpty); | ||
document.getElementById('closeBttn').addEventListener('click',function(){document.getElementById('missingcontent').style.display = "none";}); | ||
|
||
var typeTimer; | ||
var doneTypingInterval = 2000 //ms | ||
|
||
$('#inputSSO').keyup(function(){clearTimeout(typeTimer); typeTimer = setTimeout(querySSO,doneTypingInterval);}); | ||
|
||
var flag = 0; | ||
var name; | ||
var SSO; | ||
var telephone; | ||
var email; | ||
|
||
//populates the fields | ||
populate(); | ||
|
||
//sends applied changes to DB | ||
function applyChanges(){ | ||
if(flag == 0){ | ||
name = $('#inputName').val(); | ||
SSO = $('#inputSSO').val(); | ||
telephone = $('#inputTelephone').val(); | ||
email = $('#inputEmail').val(); | ||
|
||
//send these values to DB for updates to be made | ||
//EX | ||
//if(name != "") | ||
//send to database | ||
} | ||
|
||
else | ||
$('#missingcontent').css('display','block'); | ||
} | ||
|
||
//populates form fields if info exists in db already | ||
function populate(){ | ||
//get values from database | ||
|
||
//$('#inputName').val(name); | ||
//$('#inputSSO').val(SSO); | ||
//$('#inputTelephone').val(telephone); | ||
//$('#inputEmail').val(email); | ||
} | ||
|
||
function checkEmpty(){ | ||
var id = this.getAttribute('id'); | ||
if($('#' + id).val() == ""){ | ||
$('#' + id).parent().attr('class','form-group has-error'); | ||
$('#' + id).siblings('span').text(warningtext(id)) | ||
} | ||
else{ | ||
$('#' + id).parent().attr('class','form-group'); | ||
$('#' + id).siblings('span').text('') | ||
} | ||
|
||
} | ||
|
||
function warningtext(id){ | ||
if(id == "inputName") | ||
return "This is a required field."; | ||
else if (id == "inputSSO") | ||
return "Invalid SSO."; | ||
} | ||
|
||
function querySSO(){ | ||
//query to see if SSO is in database already | ||
|
||
//if so... && val() != "" | ||
//$('#' + id).parent().attr('class','form-group has-error'); | ||
//$('#inputSSO').siblings('span').text('SSO is currently in use.'); | ||
//flag = 1; | ||
|
||
//if not... && val() != "" | ||
//$('#' + id).parent().attr('class','form-group'); | ||
//$('#' + id).siblings('span').text(''); | ||
} | ||
|
||
window.onclick = function(event) { | ||
var modal = document.getElementById('missingcontent'); | ||
if(event.target == modal) | ||
modal.style.display = "none"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters