<%@ LANGUAGE =VBScript %>
<%
option explicit
%>
<!--#INCLUDE FILE="../../asp/function.asa"-->
<!--#INCLUDE file="../../asp/ums.asa"-->
<!--#INCLUDE file="../../asp/oms.asa"-->
<%
Connect
%>
<html>
<head>
<title>Training Request Form</title>
<meta name="Microsoft Border" content="none">
<LINK REL="STYLESHEET" HREF="../../htm/mainclass.css" MEDIA="screen" TYPE="text/css">
<script language="JavaScript">
//resize window to full screen after coming from small request absence screen
window.onload = maxWindow;
function maxWindow()
{
window.moveTo(0,0);
if (document.all)
{
top.window.resizeTo(screen.availWidth,screen.availHeight);
}
else if (document.layers||document.getElementById)
{
if (top.window.outerHeight<screen.availHeight||top.window.outerWidth<screen.availWidth)
{
top.window.outerHeight = screen.availHeight;
top.window.outerWidth = screen.availWidth;
}
}
}
</script>
<script language="JavaScript" type="text/JavaScript">
function fnValidateForm(objForm){
switch(objForm.name){
//validation
case "trainingForm":
var aryMandatory=[["fullname","Please enter your name","text"],["dept","Please enter your department","text"],["job","Please enter your job","text"],["organ","Please enter your organisation","text"],["venue","Please enter your venue","text"],["duration","Please enter your duration","text"],["costs","Please enter your costs","text"]];
break;
//can have another form on same validation code page
case "emailToAFriend":
var aryMandatory=[["emailTo","Please enter your friends email address.","text"],["emailFrom","Please enter your email address.","text"]];
break;
default:
// Just submit the form and don't worry.
return true;
}
// did you know FORM
var aryFormat=new Array();
var strErr="";
for(x=0;x<aryMandatory.length;x++){
switch(aryMandatory[x][2]){
case "text":
if(objForm[aryMandatory[x][0]].value == ""){
if(aryMandatory[x][0] == "cc_software_level" || aryMandatory[x][0] == "number_agents") {
if(objForm['call_center_installed'].selectedIndex == 1){
// If YES selected then error
strErr+="\n: "+aryMandatory[x][1];
}
}
else{
strErr+="\n: "+aryMandatory[x][1];
}
}
break;
case "select":
if(objForm[aryMandatory[x][0]].selectedIndex == 0){
strErr+="\n: "+aryMandatory[x][1];
}
break;
case "email":
strEmail=objForm[aryMandatory[x][0]].value;
if(strEmail == "" || strEmail.indexOf("@") == -1){
strErr+="\n: "+aryMandatory[x][1];
}
break;
}
};
// Validate fields that when not blank need checking
if(aryFormat.length > 0){
var regexpDate=new RegExp(/\d{1,2}\/\d{1,2}\/\d{2}/);
for(x=0;x<aryFormat.length;x++){
switch(aryFormat[x][2]){
case "date":
if(objForm[aryFormat[x][0]].value != ""){
if(regexpDate.test(objForm[aryFormat[x][0]].value)){
txtDate=objForm[aryFormat[x][0]].value;
aryDate=txtDate.split("/");
if(aryDate[0] > 31 || aryDate[0] < 1 || aryDate[1] >12 || aryDate[1] < 1 || aryDate[2] < 03){
strErr+="\n: "+aryFormat[x][1]+ " [e.g. 20/01/03]";
}
}
else{
strErr+="\n: "+aryFormat[x][1];
};
}
break;
}
}
}
if(strErr != ""){
alert("You have missed some fields...\n--------------------"+strErr);
return false;
};
return true;
}
</script>
<script language=javascript>
function showHide(obj, bool) {
obj.style.display = (bool) ? "" : "none";
}
</script>
</HEAD>
<BODY style='font-family: arial; font-size: 10px'>
<%
'Grab user name
Dim user
Dim SQL
Dim RS
Dim usersname
Dim sUserUID
user=GetSession("gUserUID")
' response.write user
SQL = "SELECT * FROM tUserDirectory WHERE useruid = '" & user & "'"
set RS = server.CreateObject("ADODB.RECORDSET")
RS.open SQL,objconn,3,3
usersname = RS("firstname") + " " + RS("surname")
'for manager contact
sUserUID=RS("useruid")
%>
<form action='process.asp' method='post' onSubmit="return fnValidateForm(this);" name="trainingForm">
<table width="100%" border="1" cellspacing="0" cellpadding="3">
<tr>
<td align="center" bordercolor="#000000"><b style='font-size: 18px'>Training / Development Request Form</b></td>
</tr>
</table>
<br clear=all>
<table width="100%" border="0" cellspacing="3" cellpadding="3" style='border: 1px solid #000000'>
<tr>
<td><b>Name:</b> <input name="fullname" type="text" value="<%=usersname%>"><br>
<b>Department:</b> <input name="dept" type="text"></td>
<td><b>Date:</b> <input name="date" type="text" value="from (yyyymmdd)"> <input name="dateto" type="text" value="to (yyyymmdd)"><br>
<b>Job Title:</b> <input name="job" type="text"></td>
</tr>
</table>
<br clear=all>
<table width="100%" border="0" cellspacing="3" cellpadding="3" style='border: 1px solid #000000'>
<tr>
<td colspan="2"><b>Planned Training / Development Activity</b><br>
<br></td>
</tr>
<tr>
<td width="25%" valign="top">Who with / name of organisation</td>
<td width="75%"><textarea name="organ" rows="2"></textarea></td>
</tr>
<tr>
<td valign="top">Where / venue</td>
<td><textarea name="venue" rows="4" id="venue"></textarea></td>
</tr>
<tr>
<td valign="top">Duration (in days, i.e. 1)</td>
<td><input name="duration" type="text" id="duration"></td>
</tr>
<tr>
<td valign="top">Costs</td>
<td><input name="costs" type="text" id="costs" value="£"></td>
</tr>
<tr>
<td valign="top">Do you require train tickets?</td>
<td>
<input type="radio" name="train" value="yes" onclick='showHide(document.getElementById("trainSection"), true)'> yes
<input type="radio" name="train" value="no" onclick='showHide(document.getElementById("trainSection"), false)' checked>no</td>
</tr>
<span id=trainSection style='display:none'>
<tr>
<td colspan=2>
sdfsdf
</td>
</tr>
</span>
<tr>
<td colspan="2" valign="top"><p>Objectives (what do you intend to learn from this training event?)<br>
1.
<textarea name="obj1" cols="60" rows="4" id="obj1"></textarea>
<br>
2.
<textarea name="obj2" cols="60" rows="4" id="obj2"></textarea>
<br>
3.
<textarea name="obj3" cols="60" rows="4" id="obj3"></textarea>
</p></td>
</tr>
<tr>
<td colspan="2" valign="top">I agree that the information above is correct to the best of my knowledge
<input type="radio" name="agree" value="yes"></td>
</tr>
</table>
<%
dim objUser
dim objManager
Set objUser=new CUser
Set objManager=new CUser
objUser.LoadUser(sUserUID)
if objUser.m_sManagerUID<>"" then
objManager.LoadUser(objUser.m_sManagerUID)
end if
%>
<input type="hidden" name="manager" value="<%=objManager.m_sEmail%>">
<input type="hidden" name="managerID" value="<%=objUser.m_sManagerUID%>">
<input type="hidden" name="user" value="<%=objUser.m_sEmail%>">
<input type="submit" value="Submit">
</form>
</BODY>
</HTML>
<%
Disconnect
%>