Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
- <!--#include file="Connections/ColourShade.asp" -->
- <!--#include file="Connections/adovbs.inc" -->
- <%
- Dim GradeFindAll__COLOUR_SHADE_RECORD_ID
- GradeFindAll__COLOUR_SHADE_RECORD_ID = "0"
- if(Request("NO_RUNTIME_VALUE") <> "") then GradeFindAll__COLOUR_SHADE_RECORD_ID = Request("NO_RUNTIME_VALUE")
- %>
- <%
- set GradeFindAll = Server.CreateObject("ADODB.Command")
- GradeFindAll.ActiveConnection = MM_ColourShade_STRING
- GradeFindAll.CommandText = "dbo.GRADE_FIND_ALL"
- GradeFindAll.Parameters.Append GradeFindAll.CreateParameter("@RETURN_VALUE", 3, 4)
- GradeFindAll.Parameters.Append GradeFindAll.CreateParameter("@COLOUR_SHADE_RECORD_ID", 3, 1,4,GradeFindAll__COLOUR_SHADE_RECORD_ID)
- GradeFindAll.CommandType = 4
- GradeFindAll.CommandTimeout = 0
- GradeFindAll.Prepared = true
- set Grades = GradeFindAll.Execute
- Grades_numRows = 0
- %>
- <%
- If Request("MACHINENAME") <> "" Then
- Session("MACHINENAME") = Request("MACHINENAME")
- ElseIf Session("MACHINENAME") = "" Then
- Response.Redirect("index.asp")
- End If
- Session("GRADEID") = ""
- Session("GRADEDESCRIPTION") = ""
- Session("STANDARDDESCRIPTION") = ""
- Session("ORDER") = ""
- Session("DATEFROM") = ""
- Session("DATETO") = ""
- %>
- <html>
- <head>
- <title>Colour and Shade Database</title>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <link href="basic.css" rel="stylesheet" type="text/css">
- <script language="JavaScript" type="text/JavaScript">
- <!--
- function FDK_StripChars(theFilter,theString)
- {
- var strOut,i,curChar
- strOut = ""
- for (i=0;i < theString.length; i++)
- {
- curChar = theString.charAt(i)
- if (theFilter.indexOf(curChar) < 0) // if it's not in the filter, send it thru
- strOut += curChar
- }
- return strOut
- }
- function FDK_AddToValidateArray(FormName,FormElement,Validation,SetFocus)
- {
- var TheRoot=eval("document."+FormName);
- if (!TheRoot.ValidateForm)
- {
- TheRoot.ValidateForm = true;
- eval(FormName+"NameArray = new Array()")
- eval(FormName+"ValidationArray = new Array()")
- eval(FormName+"FocusArray = new Array()")
- }
- var ArrayIndex = eval(FormName+"NameArray.length");
- eval(FormName+"NameArray[ArrayIndex] = FormElement");
- eval(FormName+"ValidationArray[ArrayIndex] = Validation");
- eval(FormName+"FocusArray[ArrayIndex] = SetFocus");
- }
- function FDK_ValidateDate(FormElement,Required,MinDate,MaxDate,Format,ErrorMsg)
- {
- var msg = "";
- var theString = DateCheck(FormElement.value);
- var dateVar = new Date(theString);
- var peavd = ErrorMsg;
- var d = dateVar;
- var fullYear = d.getYear();
- if (fullYear <= 10) fullYear += 2000;
- if (fullYear <= 200) fullYear += 1900;
- d.setYear(fullYear)
- dateVar.setYear(fullYear)
- var theLen = FDK_StripChars(" ",theString).length
- if (theLen == 0)
- {
- if (!Required) return "";
- else return peavd;
- }
- if (isNaN(dateVar.valueOf()) || (dateVar.valueOf() == 0))
- return peavd;
- // Check for correct range.
- if (MinDate != "")
- {
- var Today = new Date(MinDate);
- if (dateVar <= Today)
- return peavd;
- }
- if (MaxDate != "")
- {
- var Today = new Date(MaxDate);
- if (dateVar >= Today)
- return peavd;
- }
- // We have a valid date. Reformat it and write it back to the control
- var style = Format;
- if (style == "2") {
- var date_string = (d.getMonth()+1) + "/" + d.getDate() + "/" + fullYear;
- }
- else if (style == "3") {
- var date_string = (d.getMonth()+1) + "-" + d.getDate() + "-" + fullYear;
- }
- else if (style == "4") {
- var date_string = d.getDate() + "/" + (d.getMonth()+1) + "/" + fullYear;
- }
- else if (style == "5") {
- var date_string = getMonthName(d) + " " + d.getDate() + ", " + fullYear;
- }
- else if (style == "6") {
- var date_string = getDayName(d) + " " + getMonthName(d) + " " + d.getDate() + ", " + fullYear;
- }
- else if (style == "7") {
- var date_string = d.toLocaleString();
- }
- else if (style == "1") {
- var date_string = theString;
- }
- else {
- var date_string = d.toGMTString();
- }
- FormElement.value=date_string;
- return msg;
- }
- function FDK_AddDateValidation(FormName,FormElementName,Required,StartDate,EndDate,Format,SetFocus,ErrorMsg) {
- var ValString = "FDK_ValidateDate("+FormElementName+","+Required+","+StartDate+","+EndDate+","+Format+","+ErrorMsg+")"
- FDK_AddToValidateArray(FormName,eval(FormElementName),ValString,SetFocus)
- }
- function FDK_Validate(FormName, stopOnFailure, AutoSubmit, ErrorHeader)
- {
- var theFormName = FormName;
- var theElementName = "";
- if (theFormName.indexOf(".")>=0)
- {
- theElementName = theFormName.substring(theFormName.indexOf(".")+1)
- theFormName = theFormName.substring(0,theFormName.indexOf("."))
- }
- var ValidationCheck = eval("document."+theFormName+".ValidateForm")
- if (ValidationCheck)
- {
- var theNameArray = eval(theFormName+"NameArray")
- var theValidationArray = eval(theFormName+"ValidationArray")
- var theFocusArray = eval(theFormName+"FocusArray")
- var ErrorMsg = "";
- var FocusSet = false;
- var i
- var msg
- // Go through the Validate Array that may or may not exist
- // and call the Validate function for all elements that have one.
- if (String(theNameArray)!="undefined")
- {
- for (i = 0; i < theNameArray.length; i ++)
- {
- msg="";
- if (theNameArray[i].name == theElementName || theElementName == "")
- {
- msg = eval(theValidationArray[i]);
- }
- if (msg != "")
- {
- ErrorMsg += "\n"+msg;
- if (stopOnFailure == "1")
- {
- if (theFocusArray[i] && !FocusSet)
- {
- FocusSet=true;
- theNameArray[i].focus();
- }
- alert(ErrorHeader+ErrorMsg);
- document.MM_returnValue = false;
- break;
- }
- else
- {
- if (theFocusArray[i] && !FocusSet)
- {
- FocusSet=true;
- theNameArray[i].focus();
- }
- }
- }
- }
- }
- if (ErrorMsg!="" && stopOnFailure != "1")
- {
- alert(ErrorHeader+ErrorMsg);
- }
- document.MM_returnValue = (ErrorMsg=="");
- if (document.MM_returnValue && AutoSubmit)
- {
- eval("document."+FormName+".submit()")
- }
- }
- }
- function DateCheck(dateString) {
- var monthNames = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
- // Check to see whether the date entered is in the 'xx/xx/xx' format
- // Spilt into an array on the '/' and check for a resulting array
- // length of 3 items. If it's not in the 'xx/xx/xx' format then check
- // whether Javascript can parse the field as a date. If it can then
- // just return the field value untouched.
- var dateArray = dateString.split("/");
- if (dateArray.length != 3) {
- var dateVar = new Date(dateString);
- if (isNaN(dateVar.valueOf()) || (dateVar.valueOf() == 0))
- return "";
- else
- return dateString;
- }
- // If it's in the 'xx/xx/xx' format then assume it means 'dd/mm/yy'
- // and assign the array items to variables matching the day,
- // month and year accordingly.
- // Note: parsing a 2 digit year as an integer will remove any leading
- // zero and effectively when re-converted to a string below, it will
- // have a string length of one character.
- var dayBit, monthBit, yearBit;
- dayBit = parseInt(dateArray[0], 10);
- monthBit = parseInt(dateArray[1], 10);
- yearBit = parseInt(dateArray[2], 10);
- // If the year was 2 digits, make it 4.
- // There will be no records will be prior to 2000.
- var strYearBit = new String(yearBit);
- if (strYearBit.length == 2)
- yearBit = parseInt("20" + strYearBit, 10);
- if (strYearBit.length == 1)
- yearBit = parseInt("200" + strYearBit, 10);
- // Check for invalid month.
- if (monthBit > 12 || monthBit == 0)
- return "";
- // Check for invalid number of days with respect to the chosen month.
- if (monthBit == 2)
- {
- // Leap years are divisible by 4, except years also divisible by 100 which aren't leap years.
- daysInFebruary = yearBit % 4 == 0 && (yearBit % 100 != 0 || yearBit % 400 == 0) ? 29 : 28;
- if (dayBit < 1 || dayBit > daysInFebruary)
- return "";
- }
- else if (monthBit == 4 || monthBit == 6 || monthBit == 9 || monthBit == 11)
- {
- if (dayBit < 1 || dayBit > 30)
- return "";
- }
- else if (dayBit < 1 || dayBit > 31)
- return "";
- // Return the 'monthname d, yyyy'. Otherwise JavaScript will
- // attempt to interpret it as an American format.
- return monthNames[monthBit - 1] + " " + dayBit + ", " + yearBit;
- }
- //-->
- </script>
- </head>
- <body onLoad="FDK_AddDateValidation('form1','document.form1.DATEFROM',true,'\'\'','\'\'','\'1\'',true,'\'Dated between : Please enter a valid date in the \\\'from\\\' field\'');FDK_AddDateValidation('form1','document.form1.DATETO',true,'\'\'','\'\'','\'1\'',true,'\'Dated between : Please enter a valid date in the \\\'to\\\' field\'')">
- <table align="center" cellpadding="0" cellspacing="0" class="layout">
- <tr>
- <td class="layoutToolbar">
- <table border="0" cellspacing="0" cellpadding="0">
- <tr>
- <!--#include file="toolbarCells.asp" -->
- </tr>
- </table></td>
- <td align="right" class="layoutLogo"><img src="images/arjoLogo.jpg"></td>
- </tr>
- <tr>
- <td colspan="2" class="layoutPageHeading">Search for records on <%= Session("MACHINENAME") %></td>
- </tr>
- <tr>
- <td colspan="2" class="layoutContent">
- <form action="results.asp" method="get" name="form1" onSubmit="FDK_Validate('form1',true,false,'The Form Could Not Be Submitted\n\n');return document.MM_returnValue">
- <table class="tableCenterWidth" align="center">
- <tr>
- <td width="20%" class="normalFont9BlueBold">Standard</td>
- <td width="10%"> <select name="GRADEID" id="select4">
- <option value="0"></option>
- <%
- While (NOT Grades.EOF)
- %>
- <option value="<%=(Grades.Fields.Item("GRADE_ID").Value)%>"><%=(Grades.Fields.Item("STANDARD").Value)%></option>
- <%
- Grades.MoveNext()
- Wend
- If (Grades.CursorType > 0) Then
- Grades.MoveFirst
- Else
- Grades.Requery
- End If
- %>
- </select>
- </td>
- <td width="10%" align="center" class="normalFont9BlueBold">Or</td>
- <td width="20%" class="normalFont9BlueBold">Standard contains</td>
- <td width="25%"> <input name="STANDARDDESCRIPTION" type="text" id="STANDARDDESCRIPTION" size="8" maxlength="8">
- </td>
- <td width="15%" align="right"> <input type="submit" name="Submit" value="Search"></td>
- </tr>
- <tr>
- <td class="normalFont9BlueBold"> </td>
- <td colspan="5"> </td>
- </tr>
- <tr>
- <td class="normalFont9BlueBold">Grade contains</td>
- <td colspan="5"> <input name="GRADEDESCRIPTION" type="text" id="GRADEDESCRIPTION5" size="30">
- </td>
- </tr>
- <tr>
- <td class="normalFont9BlueBold"> </td>
- <td colspan="5"> </td>
- </tr>
- <tr>
- <td class="normalFont9BlueBold">Dated between</td>
- <td><input name="DATEFROM" type="text" id="DATEFROM" value="<%= DateAdd("yyyy", -10, Date()) %>" size="10" maxlength="20"></td>
- <td align="center" class="normalFont9BlueBold">And</td>
- <td colspan="3"><input name="DATETO" type="text" id="DATETO" value="<%= Date() %>" size="10" maxlength="20"></td>
- </tr>
- <tr>
- <td class="normalFont9BlueBold"> </td>
- <td colspan="5"> </td>
- </tr>
- <tr>
- <td class="normalFont9BlueBold">Order by</td>
- <td colspan="5"><table>
- <tr>
- <td class="normalFont9BlueBold"> <label>
- <input name="ORDER" type="radio" value="2" checked>
- Standard, Date</label></td>
- <td class="normalFont9BlueBold"> <label>
- <input type="radio" name="ORDER" value="1">
- Running Order</label></td>
- </tr>
- </table></td>
- </tr>
- <tr>
- <td colspan="6" align="right"> </td>
- </tr>
- </table>
- </form>
- </td>
- </tr>
- </table>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement