Hi,
Im trying to find a way to duplicate a new form when I create a new form. I have an existing form with values in them. Now I want to create a new form but I would like to inherit the values from the previous form. So basically this new form is created a a revision copy.
Form 1 - has values
Form 2 -would like to create with values in form 1 already present (do not want to type in again). Will be the revision copy of form 1.
Each form has a request ID. Hopefully Im clear enough. Pleace let me know If need to provie more info. Thx!!
<%
requestID = Request.QueryString("id")
requestPassword = Request.QueryString("password")
Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open = ConnectionString("TIS")
%>
<title>IS - Create Request</title>
<SCRIPT language="javascript" type="text/javascript" SRC="../../../lib/dateFunctions.js">
</SCRIPT>
<script language="javascript" type="text/javascript">
function validateEmail(email) {
var emailFilter=/^.+@.+\..{2,3}$/;
var illegalChars= /[\(\)\<\>\,\;\:\\\/\"\[\]]/;
email = email.replace(/^\s*|\s*$/g,"");;
if (email.match(illegalChars)) {
return false;
}
if (!(emailFilter.test(email))) {
return false;
}
window.onbeforeunload = null
return true;
}
function verify(form) {
form.SaveCheck.value = "NO"
var days = DateDiff(form.TxtHandover.value, form.TxtImplementation.value);
var FYIEmailList=form.TxtFYI.value.split(",");
var invalidEmails = "";
var i=0;
while (i < FYIEmailList.length){
if (FYIEmailList != "" && !validateEmail(FYIEmailList)) {
invalidEmails = invalidEmails + FYIEmailList + "\n"
}
i+=1;
}
if (invalidEmails != "") {
alert("The following emails you selected for FYI are not valid:\n\n" + invalidEmails);
return false;
}
if (form.TxtInitiator.value == "") {
alert("Please enter in your name");
form.TxtInitiator.focus();
return false;
}
else if (!validateEmail(form.TxtInitiatorEmail.value)) {
alert("Please enter in a valid Initiator email");
form.TxtInitiatorEmail.focus();
return false;
}
else if (form.TxtProjectName.value == "") {
alert("Please enter in the Project Name");
form.TxtProjectName.focus();
return false;
}
else if (!form.RbtTier[3].checked && form.TxtProjectManager.value == "") {
alert("Please enter in the Project Manager");
form.TxtProjectManager.focus();
return false;
}
else if (!form.RbtTier[3].checked && !validateEmail(form.TxtProjectManagerEmail.value)) {
alert("Please enter in a valid Project Manager email");
form.TxtProjectManagerEmail.focus();
return false;
}
else if (form.TxtITNum.value != "" && (form.TxtITNum.value.indexOf("IT") != 0 && form.TxtITNum.value.indexOf("it") != 0)) {
alert("IT Number must be in the format ITXXXX, or blank");
form.TxtITNum.focus();
return false;
}
else if (form.DDLProjectPhase.value == "") {
alert("Please select what phase the project is currently in");
form.DDLProjectPhase.focus();
return false;
}
else if (form.TxtCCC.value == "") {
alert("Please enter in the Customer Cost Centre");
form.TxtCCC.focus();
return false;
}
else if (form.TxtBU.value == "") {
alert("Please enter in a Business Unit");
form.TxtBU.focus();
return false;
}
else if (form.TxtDescription.value == "") {
alert("Please enter in the Description");
form.TxtDescription.focus();
return false;
}
else if (!form.RbtChangeType[0].checked && !form.RbtChangeType[1].checked && !form.RbtChangeType[2].checked) {
alert("Please select what type of changes are happening");
return false;
}
else if ((form.RbtChangeType[0].checked || form.RbtChangeType[2].checked ) && form.TxtDistributedApps.value == "" ) {
alert("Please select the Distributed Applications Impacted");
return false;
}
else if ((form.RbtChangeType[1].checked || form.RbtChangeType[2].checked ) && form.TxtHostApps.value == "" ) {
alert("Please select the Host Applications Impacted");
return false;
}
else if (form.TxtHandover.value == "" && (form.DDLProjectPhase.value == "Charter" || form.DDLProjectPhase.value == "PDD" )) {
alert("Proposed handover date is requiered for projects in Charter or PDD");
form.TxtHandover.focus();
return false;
}
else if (form.TxtHandover.value == "" && ( form.RbtTier[3].checked)) {
alert("Proposed handover date is requiered for AM requests");
form.TxtHandover.focus();
return false;
}
else if (form.TxtImplementation.value == "") {
alert("Please enter in the proposed implementation date");
form.TxtImplementation.focus();
return false;
}
else if (days != NaN && days < 0) {
alert("Proposed implementation date must be after the proposed handover date");
form.TxtImplementation.focus();
return false;
}
else if (form.TxtGroups.value == "") {
alert("Please select at least one group involved");
form.TxtGroups.focus();
return false;
}
else if (!form.RbtTier[0].checked && !form.RbtTier[1].checked && !form.RbtTier[2].checked && !form.RbtTier[3].checked ) {
alert("Please select a tier");
return false;
}
else if (form.DDLDevGroup.value == "") {
alert("Please who the TS Development group is");
form.DDLDevGroup.focus();
return false;
}
else if (form.DDLUrgent.value == "") {
alert("Please select if this change is urgent");
form.DDLUrgent.focus();
return false;
}
else if ( form.TxtITNum.value == "") {
var answer = confirm("You have not entered in an IT Number. Are you currently in the process on creating one?\n\nPress Ok if the IT Number is in the process of being created\nPress Cancel if you are not going to create an IT Number");
if (answer == true) {
form.TxtCreatingITNumber.value = "Yes"
}
else
{
form.TxtCreatingITNumber.value = "No"
}
}
window.onbeforeunload = null
return true;
}
function save(form) {
if (form.TxtInitiator.value == "") {
alert("Please enter in your name");
form.TxtInitiator.focus();
return false;
}
else if (form.TxtInitiatorEmail.value == "") {
alert("Please enter in your email");
form.TxtInitiatorEmail.focus();
return false;
}
else if (!validateEmail(form.TxtInitiatorEmail.value)) {
alert("Please enter in a valid email");
form.TxtInitiatorEmail.focus();
return false;
}
else
{
form.SaveCheck.value = "YES"
form.submit();
}
}
function AppPopup(vFieldName, vApps, vAppListing){
var nW = window.open("", "ModifyApps", "resizable=no,scrollbars=yes,width=810,height=310");
nW.location.href="modifyApp.asp?Apps=" + escape(vApps) + "&DB=" + escape(vAppListing) + "&returnField=" + vFieldName;
nW = null;
}
function GroupPopup(vFieldName, vGroups){
var nW = window.open("", "ModifyGroups", "resizable=no,scrollbars=yes,width=810,height=310");
nW.location.href="ModifyGroups.asp?Groups=" + escape(vGroups) + "&returnField=" + vFieldName;
nW = null;
}
function PCOEPopup(){
var nW = window.open("", "PCOEQuestionaire", "resizable=0,scrollbars=yes,width=800,height=700");
nW.location.href="performanceQuestions.asp";
nW = null;
}
function updateBU()
{
var CCCArray = new Array(
<%
strSQL3 = "select CostCentre, BusUnit from T_C_BusUnit"
set oRs3 = oConn.Execute(strSQL3)
WHILE NOT oRs3.EOF
Response.write "'"& Trim(oRs3("CostCentre")) &"','"& Trim(oRs3("BusUnit")) &"'"
oRs3.MoveNext
if oRs3.EOF = TRUE Then
Response.write ");"
else
Response.write ","
end if
WEND
%>
var CC = document.form1.TxtCCC.value;
var BusUnit = "";
for (var i = 0; i <CCCArray.length; i++)
{
if (CC == CCCArray)
{
BusUnit = CCCArray[i+1]
}
}
if (BusUnit != "") {
document.form1.TxtBU.value = BusUnit;
}
}
function confirmExit()
{
return "Click \"Save as Draft\" to be able to return to this form at a later time";
}
function checkProposed() {
if (document.form1.DDLProjectPhase.value == "Charter" || document.form1.DDLProjectPhase.value == "PDD") {
document.getElementById("proposedRequired").style.display = "inline";
}
else {
document.getElementById("proposedRequired").style.display = "none";
}
}
function checkAM() {
if (document.form1.RbtTier[3].checked) {
document.getElementById("PMRequired").style.display = "none";
document.getElementById("PMEmailRequired").style.display = "none";
document.getElementById("proposedRequired").style.display = "inline";
}
else {
document.getElementById("PMRequired").style.display = "inline";
document.getElementById("PMEmailRequired").style.display = "inline";
document.getElementById("proposedRequired").style.display = "none";
}
}
function limitText(limitField, limitNum) {
if (limitField.value.length > limitNum) {
limitField.value = limitField.value.substring(0, limitNum);
}
}
window.onbeforeunload = confirmExit;
</script>
</head>
Im trying to find a way to duplicate a new form when I create a new form. I have an existing form with values in them. Now I want to create a new form but I would like to inherit the values from the previous form. So basically this new form is created a a revision copy.
Form 1 - has values
Form 2 -would like to create with values in form 1 already present (do not want to type in again). Will be the revision copy of form 1.
Each form has a request ID. Hopefully Im clear enough. Pleace let me know If need to provie more info. Thx!!
<%
requestID = Request.QueryString("id")
requestPassword = Request.QueryString("password")
Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open = ConnectionString("TIS")
%>
<title>IS - Create Request</title>
<SCRIPT language="javascript" type="text/javascript" SRC="../../../lib/dateFunctions.js">
</SCRIPT>
<script language="javascript" type="text/javascript">
function validateEmail(email) {
var emailFilter=/^.+@.+\..{2,3}$/;
var illegalChars= /[\(\)\<\>\,\;\:\\\/\"\[\]]/;
email = email.replace(/^\s*|\s*$/g,"");;
if (email.match(illegalChars)) {
return false;
}
if (!(emailFilter.test(email))) {
return false;
}
window.onbeforeunload = null
return true;
}
function verify(form) {
form.SaveCheck.value = "NO"
var days = DateDiff(form.TxtHandover.value, form.TxtImplementation.value);
var FYIEmailList=form.TxtFYI.value.split(",");
var invalidEmails = "";
var i=0;
while (i < FYIEmailList.length){
if (FYIEmailList != "" && !validateEmail(FYIEmailList)) {
invalidEmails = invalidEmails + FYIEmailList + "\n"
}
i+=1;
}
if (invalidEmails != "") {
alert("The following emails you selected for FYI are not valid:\n\n" + invalidEmails);
return false;
}
if (form.TxtInitiator.value == "") {
alert("Please enter in your name");
form.TxtInitiator.focus();
return false;
}
else if (!validateEmail(form.TxtInitiatorEmail.value)) {
alert("Please enter in a valid Initiator email");
form.TxtInitiatorEmail.focus();
return false;
}
else if (form.TxtProjectName.value == "") {
alert("Please enter in the Project Name");
form.TxtProjectName.focus();
return false;
}
else if (!form.RbtTier[3].checked && form.TxtProjectManager.value == "") {
alert("Please enter in the Project Manager");
form.TxtProjectManager.focus();
return false;
}
else if (!form.RbtTier[3].checked && !validateEmail(form.TxtProjectManagerEmail.value)) {
alert("Please enter in a valid Project Manager email");
form.TxtProjectManagerEmail.focus();
return false;
}
else if (form.TxtITNum.value != "" && (form.TxtITNum.value.indexOf("IT") != 0 && form.TxtITNum.value.indexOf("it") != 0)) {
alert("IT Number must be in the format ITXXXX, or blank");
form.TxtITNum.focus();
return false;
}
else if (form.DDLProjectPhase.value == "") {
alert("Please select what phase the project is currently in");
form.DDLProjectPhase.focus();
return false;
}
else if (form.TxtCCC.value == "") {
alert("Please enter in the Customer Cost Centre");
form.TxtCCC.focus();
return false;
}
else if (form.TxtBU.value == "") {
alert("Please enter in a Business Unit");
form.TxtBU.focus();
return false;
}
else if (form.TxtDescription.value == "") {
alert("Please enter in the Description");
form.TxtDescription.focus();
return false;
}
else if (!form.RbtChangeType[0].checked && !form.RbtChangeType[1].checked && !form.RbtChangeType[2].checked) {
alert("Please select what type of changes are happening");
return false;
}
else if ((form.RbtChangeType[0].checked || form.RbtChangeType[2].checked ) && form.TxtDistributedApps.value == "" ) {
alert("Please select the Distributed Applications Impacted");
return false;
}
else if ((form.RbtChangeType[1].checked || form.RbtChangeType[2].checked ) && form.TxtHostApps.value == "" ) {
alert("Please select the Host Applications Impacted");
return false;
}
else if (form.TxtHandover.value == "" && (form.DDLProjectPhase.value == "Charter" || form.DDLProjectPhase.value == "PDD" )) {
alert("Proposed handover date is requiered for projects in Charter or PDD");
form.TxtHandover.focus();
return false;
}
else if (form.TxtHandover.value == "" && ( form.RbtTier[3].checked)) {
alert("Proposed handover date is requiered for AM requests");
form.TxtHandover.focus();
return false;
}
else if (form.TxtImplementation.value == "") {
alert("Please enter in the proposed implementation date");
form.TxtImplementation.focus();
return false;
}
else if (days != NaN && days < 0) {
alert("Proposed implementation date must be after the proposed handover date");
form.TxtImplementation.focus();
return false;
}
else if (form.TxtGroups.value == "") {
alert("Please select at least one group involved");
form.TxtGroups.focus();
return false;
}
else if (!form.RbtTier[0].checked && !form.RbtTier[1].checked && !form.RbtTier[2].checked && !form.RbtTier[3].checked ) {
alert("Please select a tier");
return false;
}
else if (form.DDLDevGroup.value == "") {
alert("Please who the TS Development group is");
form.DDLDevGroup.focus();
return false;
}
else if (form.DDLUrgent.value == "") {
alert("Please select if this change is urgent");
form.DDLUrgent.focus();
return false;
}
else if ( form.TxtITNum.value == "") {
var answer = confirm("You have not entered in an IT Number. Are you currently in the process on creating one?\n\nPress Ok if the IT Number is in the process of being created\nPress Cancel if you are not going to create an IT Number");
if (answer == true) {
form.TxtCreatingITNumber.value = "Yes"
}
else
{
form.TxtCreatingITNumber.value = "No"
}
}
window.onbeforeunload = null
return true;
}
function save(form) {
if (form.TxtInitiator.value == "") {
alert("Please enter in your name");
form.TxtInitiator.focus();
return false;
}
else if (form.TxtInitiatorEmail.value == "") {
alert("Please enter in your email");
form.TxtInitiatorEmail.focus();
return false;
}
else if (!validateEmail(form.TxtInitiatorEmail.value)) {
alert("Please enter in a valid email");
form.TxtInitiatorEmail.focus();
return false;
}
else
{
form.SaveCheck.value = "YES"
form.submit();
}
}
function AppPopup(vFieldName, vApps, vAppListing){
var nW = window.open("", "ModifyApps", "resizable=no,scrollbars=yes,width=810,height=310");
nW.location.href="modifyApp.asp?Apps=" + escape(vApps) + "&DB=" + escape(vAppListing) + "&returnField=" + vFieldName;
nW = null;
}
function GroupPopup(vFieldName, vGroups){
var nW = window.open("", "ModifyGroups", "resizable=no,scrollbars=yes,width=810,height=310");
nW.location.href="ModifyGroups.asp?Groups=" + escape(vGroups) + "&returnField=" + vFieldName;
nW = null;
}
function PCOEPopup(){
var nW = window.open("", "PCOEQuestionaire", "resizable=0,scrollbars=yes,width=800,height=700");
nW.location.href="performanceQuestions.asp";
nW = null;
}
function updateBU()
{
var CCCArray = new Array(
<%
strSQL3 = "select CostCentre, BusUnit from T_C_BusUnit"
set oRs3 = oConn.Execute(strSQL3)
WHILE NOT oRs3.EOF
Response.write "'"& Trim(oRs3("CostCentre")) &"','"& Trim(oRs3("BusUnit")) &"'"
oRs3.MoveNext
if oRs3.EOF = TRUE Then
Response.write ");"
else
Response.write ","
end if
WEND
%>
var CC = document.form1.TxtCCC.value;
var BusUnit = "";
for (var i = 0; i <CCCArray.length; i++)
{
if (CC == CCCArray)
{
BusUnit = CCCArray[i+1]
}
}
if (BusUnit != "") {
document.form1.TxtBU.value = BusUnit;
}
}
function confirmExit()
{
return "Click \"Save as Draft\" to be able to return to this form at a later time";
}
function checkProposed() {
if (document.form1.DDLProjectPhase.value == "Charter" || document.form1.DDLProjectPhase.value == "PDD") {
document.getElementById("proposedRequired").style.display = "inline";
}
else {
document.getElementById("proposedRequired").style.display = "none";
}
}
function checkAM() {
if (document.form1.RbtTier[3].checked) {
document.getElementById("PMRequired").style.display = "none";
document.getElementById("PMEmailRequired").style.display = "none";
document.getElementById("proposedRequired").style.display = "inline";
}
else {
document.getElementById("PMRequired").style.display = "inline";
document.getElementById("PMEmailRequired").style.display = "inline";
document.getElementById("proposedRequired").style.display = "none";
}
}
function limitText(limitField, limitNum) {
if (limitField.value.length > limitNum) {
limitField.value = limitField.value.substring(0, limitNum);
}
}
window.onbeforeunload = confirmExit;
</script>
</head>