MSV FM

dot.antimicrobial@66.96.161.157: ~ $
Path : /hermes/sb_web/b1536/advancedfunctions.co/AMBV2_V7/
File Upload :
Current < : /hermes/sb_web/b1536/advancedfunctions.co/AMBV2_V7/verifyPatientAMB.js

//a form is created with a submit button
//the allowed character types must be selected when creating a field

/**  Insert the following in the head tags
<meta http-equiv='Content-Type' content='text/html; charset=UTF-8'>
<meta name='viewport' content='width=device-width, initial-scale=1.0'>
<link rel='stylesheet' href='https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css'>
<link rel='stylesheet' href='googleSheetsPortal.css'>
<script src='guiForm.js'></script>
**/

/**
Call this function to get the text in a field
function getFieldText(nameOfField)
**/

/**
Call this function to create a text field
function makeField(nameOfField)
**/

/**
Call this function to get the UI as a string
getFormUiAsString()
**/

/**  Insert the following in the script tags to execute code once the submit button has be pressed
function send(){}
**/

var fieldsAsString='';
var showSearchInfoUi=false;

function getFormUiAsString(){
return "<button id='dropDownInfo' onclick='javascript:toggleInfoUiVisible()' style='background-color:white;border:none'> <h4>Verify Patient Info &#9650;</h4></button><div  id='searchInfoUi'><div class='form-group grid-container' style='display: grid;grid-template-columns: auto;padding: 10px;grid-gap: 10px;'>"+fieldsAsString+"<div><button id='verifyEmailButton' class='btn btn-default'  onclick= 'javascript:verifyPatientEmail()' >Verify email</button> <button class='btn btn-default'  onclick= 'javascript:updatePatientInfo()' >Update info</button></div></div></div><hr>";
}

function toggleInfoUiVisible(){
if(showSearchInfoUi==true){
showSearchInfoUi=false;
document.getElementById('searchInfoUi').style.display='';
document.getElementById('dropDownInfo').innerHTML='<h4>Verify Patient Info &#9650;</h4>';}else{
showSearchInfoUi=true;
document.getElementById('searchInfoUi').style.display='none';
document.getElementById('dropDownInfo').innerHTML='<h4>Verify Patient Info &#9660;</h4>';}
}

function makeField(nameOfField){
fieldsAsString=fieldsAsString+"<input class='form-control' id='"+nameOfField+"' placeholder='"+nameOfField+"'>";
}

function makeDateField(nameOfField){
fieldsAsString=fieldsAsString+"<div style='display: grid;grid-template-columns: 100px 50px 0px 42px 0px 58px;width:250;'><span style='padding: 10px;color:gray'>"+nameOfField+"</span><input class='form-control' placeholder='mm' id='monthField'><span></span><input class='form-control' placeholder='dd' id='dayField'><span ></span><input class='form-control' placeholder='yyyy' id='yearField'></div>";
}


function getFieldText(nameOfField){
var fieldText='';
try{fieldText=document.getElementById(nameOfField).value;}catch(err){}
return fieldText;
}

function setFieldText(nameOfField,text){
document.getElementById(nameOfField).value=text;
}

function isFieldEmpty(nameOfField){
if(getFieldText(nameOfField)==''){

return true;}
return false;}

function isCharactersValid(nameOfField,type){
var text=getFieldText(nameOfField).toLowerCase();
var matchLength=-1;
if(type=='alpha'){
try{matchLength=text.match(/[a-z]/g).length;}catch(err){}
if(text.length==matchLength){
document.getElementById(nameOfField).style='background-color:white';
return true;}else{
document.getElementById(nameOfField).style='background-color:lightyellow';
return false;}
}
if(type=='numeric'){
try{matchLength=text.match(/[0-9]/g).length;}catch(err){}
if(text.length==matchLength){
document.getElementById(nameOfField).style='background-color:white';
return true;}else{
document.getElementById(nameOfField).style='background-color:lightyellow';
return false;}
}
if(type==''){
if(text.length!=0){
document.getElementById(nameOfField).style='background-color:white';
return true;}else{
document.getElementById(nameOfField).style='background-color:lightyellow';
return false;}
}


}