Link to home
Start Free TrialLog in
Avatar of kjmay82
kjmay82Flag for United States of America

asked on

Problem with one form containing two submit buttons

I have one form that runs through JavaScript validation then to a classic ASP page for processing, which is working fine.  I have been asked to create a print preview page as well.  I have added the JavaScript code below called by a form button, which works as expected.  My problem... If the submit button is clicked without using the print preview button, all is fine.  But if the print preview button is used first, then the submit button changes to also run the print preview code.

Form tag:  <form method="POST" name="frmName" action="processForm.asp" onSubmit="validate();">

Submit button:  <input type='submit' value=Submit'>

Print Preview button:  <input type='button' value='Print Preview' onClick="SendToPreviewPage()">

JavaScript code:
   function SendToPreviewPage() {
      win=window.open('','myWin','toolbars=0,scrollbars=1');
      document.frmName.target='myWin';
      document.frmName.method="post"
      document.frmName.action="previewForm.asp"
      document.frmName.submit()
   }

Thanks for any suggestions.
Avatar of James Rodgers
James Rodgers
Flag of Canada image

in teh validate routine you need to reset the action from teh printpreview page to teh from processing page
so if the form validate succesfully, meaning without error, reset teh action and then it will siubmit properly
Avatar of kjmay82

ASKER

Jester_48,
   Thanks for your comment.  Oddly enough, the printpreview code does not trigger the validation routine even though the JavaScript for that button does submit the form.  The validation code does run with the regular Submit button including when the Submit button is clicked AFTER the print preview and then proceeds to that same Print Preview page.
a javascript command like
document.frmName.submit()

will not trigger the validation, you need to call it explicitly, efore teh submitcode
function SendToPreviewPage() {
      win=window.open('','myWin','toolbars=0,scrollbars=1');
      document.frmName.target='myWin';
      document.frmName.method="post"
      document.frmName.action="previewForm.asp"
      if(validate()){
document.frmName.submit()
}
   }

>But if the print preview button is used first, then the submit button changes to also run the print preview code.
that is because teh print preview option has overwritten the default action in teh form tag
<form method="POST" name="frmName" action="processForm.asp" onSubmit="validate();">

when this line executes teh action in the formtag becomes
<form method="POST" name="frmName" action="previewForm.asp" onSubmit="validate();">
teh change ie permanent unless teh page is reloaded or another script overwrites it again
validate(){
//validation code goies here...

if(error){
alert('error message');
}else{
document.frmName.action="processForm.asp"
}


}
I suggest you make the submit button a normal button, like preview.  Javascript will be needed to this form to work but you are sort of committed to that anyways with the preview.

The modified code would be ...

Form tag:  <form method="POST" name="frmName" action="processForm.asp" onSubmit="validate();">

Submit button:  <input type='button' value=Submit' onclick='SubmitForm();'>

Print Preview button:  <input type='button' value='Print Preview' onClick="SendToPreviewPage()">

JavaScript code:
   function SendToPreviewPage() {
      win=window.open('','myWin','toolbars=0,scrollbars=1');
      document.frmName.target='myWin';
      document.frmName.method="post"
      document.frmName.action="previewForm.asp"
      document.frmName.submit()
   }

   function SubmitForm() {
      document.frmName.action="processForm.asp"
      document.frmName.submit();
   }

Let me know if you have a question or need more info.

bol
you shouldn't do this
<input type='button' value=Submit' onclick='SubmitForm();'>
function SubmitForm() {
      document.frmName.action="processForm.asp"
      document.frmName.submit();
   }

you will submit the form will not call the onsubmit event

you need to add the code in the validate routine  
Avatar of kjmay82

ASKER

Jester_48:  Your code got me closer a little closer.  When clicking the PrintPreview button, the validation does fire but if there is a blank field, the alert message is displayed, the focus goes to the appropriate field, but it also opens a new blank window in the background.  If it passes validation, a new blank window also opens.  The only thing displayed in either case is the title bar which says "about:blank".  However, it does set successfully set the document.frmName.action to processForm.asp.  However, since I don't have any error handling (yes, I know) I put "document.frmName.action="processForm.asp" in the last else statement of the validation routine (see below).  The Submit button also calls validation but when it finds a blank required field, it shows the alert message then immediately submits the form instead of returning to the blank field.  I assume this is due to my unconventional approach to setting the form target and action in the validation.

Last section from the validation:
if (frmName.memDescription.value == "" || /^\s+$/.test(frmName.memDescription.value))
            {
                  alert("Please enter a description of the project")
                  frmName.memDescription.focus();
                  return (false);
            }
      else
            {
                  document.frmName.target='';
                  document.frmName.action="processFormNEW.asp"
                  event.returnValue=true;
            }

From the print preview code:
function SendToPreviewPage() {
win=window.open('','myWin','toolbars=0,scrollbars=1');
document.frmName.target='myWin';
document.frmName.method="post"
document.frmName.action="previewForm.asp"
if(validate()){
document.frmName.submit()
}
}

b0lsc0tt:  Yes, yours is the code I started with.  Just to be sure, I copied and pasted your code into my page, took out the lines I inserted per Jester_48 in the validation, and tried it.  The submit button runs the validation fine but never submits the page.  The print preview button runs the validation, but after the alert message opens a blank window with the title bar (about: blank) and nothing else on the page.

Something I've done while playing with your suggestions has broken my print preview display.  I'll be working to get that back next.

Thanks to you both!
in oder for this lkine to work properly
if(validate()){
document.frmName.submit()
}

the validate routine needs to return a value a falkse return will not submit teh form  a true return will submit

>>I assume this is due to my unconventional approach to setting the form target and action in the validation.
shouldn't matter

can you please post the entire form and js plz
Sorry, I overlooked the onsubmit event.  I would just get rid of that event and call validate() as part of the onclick event for the Submit button.  With 2 buttons it is best to not have one be type "submit."

I didn't look over your validate function but you could probably do what I said above with ...

   function SubmitForm() {
      if (!validate()) return false;
      document.frmName.action="processForm.asp"
      document.frmName.submit();
   }

Let me know if the form still isn't submitted.  It would help to see your current code and the validate() function if there is still a problem.  My code now will want the validate() function to return true if everything is OK or false if it isn't.

Let me know if you have a question or need more info.

bol
Avatar of kjmay82

ASKER

I appreciate your help.  I've got to run now and will be working on another project tommorrow (and probably through the weekend...).  It will be Monday before I get back to this one.

b0lsc0tt:  I'll try your code change next.

Jester_48:  If I can't get b0lsc0tt's code to work, I'll post all the JS and form code on Monday.

I greatly appreciate your time.  Thanks again!!
Avatar of kjmay82

ASKER

b0lsc0tt:  I tried your code and the validation routine is now working on both the print preview and the submit, but neither button will then continue with the submit or preview functions.  The code I'm using for your buttons is below.

Jester_48:  I'm posting my validation and form code below, followed by the JavaScript which the form uses to display or hide fields.  

Reminder:  The validation and submit functions had been working for a few months.  It was only when I tried to introduce the print preview in a separate window function that things went wrong.

Thanks to you both for any other suggestions you give.
******************************************************************************************
b0lsc0tt's form buttons (buttons labeled "Monday...")

<SCRIPT language="javascript">
<!--
//submit form information to preview page
//
   function SendToPreviewPageTest() {
      if (!validate()) return false;
              win=window.open('','myWin','toolbars=0,scrollbars=1');
              document.frmISRequest.target='myWin';
              document.frmISRequest.method="post"
              document.frmISRequest.action="previewForm.asp"
              document.frmISRequest.submit()
   }
// -->
</SCRIPT>

<SCRIPT language="javascript">
<!--
function SubmitFormTest() {
      if (!validate()) return false;
      document.frmISRequest.action="processFormNEW.asp"
      document.frmISRequest.submit();
   }

// -->
</SCRIPT>
****************************************************************************************************
Jester_48 form buttons code:

<SCRIPT language="javascript">
<!--
//submit form information to preview page
//
function SendToPreviewPage() {

win=window.open('','myWin','toolbars=0,scrollbars=1');
document.frmISRequest.target='myWin';
document.frmISRequest.method="post"
document.frmISRequest.action="previewForm.asp"
//document.frmISRequest.submit()
if(validate()){
document.frmISRequest.submit()

}
}
// -->
</SCRIPT>

<SCRIPT language="javascript">
<!--
//submit form information to preview page
//
function SendToProcessPage() {
return validate();
document.frmISRequest.method="post"
document.frmISRequest.action="processFormNEW.asp"
document.frmISRequest.submit()
}
// -->
</SCRIPT>
*********************************************************************************************************
Validation script:
<SCRIPT LANGUAGE="JavaScript">
<!--
function validate() {

      if ((frmISRequest.TypeOfRequest[0].checked==false) && (frmISRequest.TypeOfRequest[1].checked==false) && (frmISRequest.TypeOfRequest[2].checked==false) && (frmISRequest.TypeOfRequest[3].checked==false) && (frmISRequest.TypeOfRequest[4].checked==false) && (frmISRequest.TypeOfRequest[5].checked==false) && (frmISRequest.TypeOfRequest[6].checked==false) && (frmISRequest.TypeOfRequest[7].checked==false))
            {
                  alert("You didn't indicate the type of request you are making.")
                  frmISRequest.TypeOfRequest[0].focus();
                  return false;
            }
      else
            {
                  event.returnValue=true;
            }

      if ((frmISRequest.TypeOfRequest[5].checked==true) && (frmISRequest.Project.value.length==0))
            {
                  alert("You selected 'Report Development' for the type of request, but didn't enter a project name")
                  frmISRequest.Project.focus();
                  return false;
            }
      else
            {
                  event.returnValue=true;
            }

      if ((frmISRequest.TypeOfRequest[5].checked==true) && (frmISRequest.reportType[0].checked==false) && (frmISRequest.reportType[1].checked==false))
            {
                  alert("You selected 'Report Development' for the type of request, but didn't a financial or management report")
                  frmISRequest.reportType[0].focus();
                  return false;
            }
      else
            {
                  event.returnValue=true;
            }

      if ((frmISRequest.TypeOfRequest[5].checked==true) && (frmISRequest.ReportName.value.length==0))
            {
                  alert("You selected 'Report Development' for the type of request, but didn't enter a report name")
                  frmISRequest.ReportName.focus();
                  return false;
            }
      else
            {
                  event.returnValue=true;
            }

      if ((frmISRequest.TypeOfRequest[5].checked==true) && (frmISRequest.DataLocated.value.length==0))
            {
                  alert("You selected 'Report Development' for the type of request, but didn't indicate where the data is located")
                  frmISRequest.DataLocated.focus();
                  return false;
            }
      else
            {
                  event.returnValue=true;
            }

      if ((frmISRequest.TypeOfRequest[6].checked==true) && (frmISRequest.spPurpose.value.length==0))
            {
                  alert("You selected 'SharePoint' for the type of request, but didn't enter a purpose")
                  frmISRequest.spPurpose.focus();
                  return false;
            }
      else
            {
                  event.returnValue=true;
            }

      if ((frmISRequest.TypeOfRequest[6].checked==true) && (frmISRequest.spShortName.value.length==0))
            {
                  alert("You selected 'SharePoint' for the type of request, but didn't enter a short name for the workspace")
                  frmISRequest.spShortName.focus();
                  return false;
            }
      else
            {
                  event.returnValue=true;
            }

      if ((frmISRequest.TypeOfRequest[6].checked==true) && (frmISRequest.SPlongName.value.length==0))
            {
                  alert("You selected 'SharePoint' for the type of request, but didn't enter the full name for the workspace")
                  frmISRequest.SPlongName.focus();
                  return false;
            }
      else
            {
                  event.returnValue=true;
            }

      if ((frmISRequest.TypeOfRequest[6].checked==true) && (frmISRequest.spDesignMembers.value.length==0) && (frmISRequest.spContributeMembers.value.length==0) && (frmISRequest.spReadOnlyMembers.value.length==0))
            {
                  alert("You selected 'SharePoint' for the type of request, but didn't enter any members for the workspace")
                  frmISRequest.spDesignMembers.focus();
                  return false;
            }
      else
            {
                  event.returnValue=true;
            }

      if ((frmISRequest.TypeOfRequest[6].checked==true) && (frmISRequest.spType[0].checked==false) && (frmISRequest.spType[1].checked==false))
            {
                  alert("You selected 'SharePoint' for the type of request, but need to indicate whether this is a permanent or temporary workspace")
                  frmISRequest.spType[0].focus();
                  return false;
            }
      else
            {
                  event.returnValue=true;
            }

      if ((frmISRequest.TypeOfRequest[6].checked==true) && (frmISRequest.spType[1].checked==true) && (frmISRequest.spEndDate.value.length==0))
            {
                  alert("You selected 'SharePoint' for the type of request and marked it as a temporary workspace, but didn't indicate when it will no longer be needed")
                  frmISRequest.spEndDate.focus();
                  return false;
            }
      else
            {
                  event.returnValue=true;
            }

      //format system date and date from user input form for comparison
      //to make sure Requested Completion Date isn't in the past
      var temp = new Date();
      var today = new Date(temp.getFullYear(),temp.getMonth(),temp.getDate());
      var datestr = document.frmISRequest.spEndDate.value;
      var fields = datestr.split("-");
      var userdate = new Date(fields[2],fields[0]-1,fields[1]);
      
      //today.setHours(0);
      //today.setMinutes(0);
      //today.setSeconds(0);
      if(today > userdate)
            {
                  alert("The SharePoint temporary workspace end date must not be past.");
                  frmISRequest.spEndDate.focus();
                  return false;
            }
      else
            {
                  event.returnValue=true;
            }



      if ((frmISRequest.TypeOfRequest[7].checked==true) && (frmISRequest.Other.value.length==0))
            {
                  alert("You selected 'Other' for the type of request, but didn't enter a description")
                  frmISRequest.Other.focus();
                  return false;
            }
      else
            {
                  event.returnValue=true;
            }

      if ((frmISRequest.TimeFrame[0].checked==false) && (frmISRequest.TimeFrame[1].checked==false) && (frmISRequest.TimeFrame[2].checked==false))
            {
                  alert("You didn't indicate a time frame in which this project is needed")
                  frmISRequest.TimeFrame[0].focus();
                  return false;
            }
      else
            {
                  event.returnValue=true;
            }

      if (frmISRequest.strProgramName.value.length==0)
            {
                  alert("Please enter the name of your project")
                  frmISRequest.strProgramName.focus();
                  return false;
            }
      else
            {
                  event.returnValue=true;
            }

      if (frmISRequest.memDescription.value == "" || /^\s+$/.test(frmISRequest.memDescription.value))
            {
                  alert("Please enter a description of the project")
                  frmISRequest.memDescription.focus();
                  return (false);
            }
      else
            {
                  document.frmISRequest.action="processFormNEW.asp"
                  document.frmISRequest.target='';
                  event.returnValue=true;
            }


}
// -->
</SCRIPT>
************************************************************************************************
Form HTML Code:
            <form method="POST" name="frmISRequest" action="processFormNEW.asp">
              <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber1" height="418">
            <tr>
              <td height="20" colspan="3"><p class="center"><b>Requested By </b></p></td>
            </tr>
            <tr>
              <td width="25%" height="20">
                    <p style="text-indent: 25px"><font face="Arial" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Name:</font></td>
              <td height="20" colspan="2">
              <font face="Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <input type="hidden" name="EmpNo" value="<%=rsEmp("EmpNum")%>">
              <%=Trim(rsEmp("FName")) & " " & rsEmp("LName")%></font></td>
            </tr>
            
            <tr>
              <td width="25%" height="18">
                    <p style="text-indent: 25px"><font size="2" face="Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Phone: </font></td>
              <td height="18" colspan="2">
                        <font face="Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <%=rsEmp("Extension")%></font></td>
            </tr>
            
            <tr>
              <td width="25%" height="18">
                    <p style="text-indent: 25px"><font face="Arial" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Department</font>:</td>
              <td height="18" colspan="2">
                        <font face="Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <%=rsEmp("Department")%></font></td>
            </tr>
            
            <tr>
              <td width="25%" height="18"><p style="text-indent: 25px"><font face="Arial" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;E-mail:</font></td>
              <td height="18" colspan="2">
                        <font face="Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <%=rsEmp("Email")%></font></td>
            </tr>
            
            <tr>
              <td width="25%" height="18">
                      <p style="text-indent: 25px"></td>
              <td height="18" colspan="2">&nbsp;</td>
            </tr>
            
            <tr>
              <td height="18" colspan="3">
                      <p style="text-indent: 25px"><strong><font face="Arial">Type of Request</font> </strong></p></td>
            </tr>
            
            <tr>
              <td height="18" colspan="2">
                          <p style="text-indent: 25px"><font face="Arial" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            <input name="TypeOfRequest" type="radio" value="New System" onClick="displayReminder(); HideIS(this,document.getElementById('RptDevRequest'));">
                              New System</font></p>                    </td>
              <td height="18">&nbsp;</td>
            </tr>
            
            <tr>
              <td height="18" colspan="2"><p style="text-indent: 25px"><font face="Arial" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        <input name="TypeOfRequest" type="radio" value="Hardware" onClick="HideIS(this,document.getElementById('RptDevRequest'));">
                        Hardware</font></p>                    </td>
              <td height="18">&nbsp;</td>
            </tr>
            <tr>
              <td height="18" colspan="2"><span style="text-indent: 25px"><font face="Arial" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                <input name="TypeOfRequest" type="radio" value="System Access Rights" onClick="HideIS(this,document.getElementById('RptDevRequest'));">
                                    System Access Rights</font></span>                    </td>
              <td height="18">&nbsp;</td>
            </tr>
            <tr>
              <td height="18" colspan="2"><p style="text-indent: 25px"><font face="Arial" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        <input name="TypeOfRequest" type="radio" value="System Enhancement" onClick="HideIS(this,document.getElementById('RptDevRequest'));">
                System Enhancement</font></p></td>
              <td height="18">&nbsp;</td>
            </tr>
            <tr>
              <td height="18" colspan="2"><p style="text-indent: 25px"><font face="Arial" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        <input name="TypeOfRequest" type="radio" value="System Revision" onClick="HideIS(this,document.getElementById('RptDevRequest'));">
                System Revision</font></p></td>
              <td height="18">&nbsp;</td>
            </tr>
            <tr>
              <td height="18" colspan="3"><p style="text-indent: 25px" ><font face="Arial" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        <input name="TypeOfRequest" type="radio" value="Report Development"
                                          onClick="ShowIS(this,document.getElementById('RptDevRequest'));">
                        Report Development</font></p>
                                    <span id="RptDevRequest" style="display=none"><font face="Arial" size="2">
                                          <p style="text-indent: 75px">Project: <input name="Project" type="text" id="Project" onBlur="CopyValue();"></p>
                                          <p style="text-indent: 75px">
                                                <input name="reportType" type="radio" value="Financial Report"> Financial Rpt
                                        <input name="reportType" type="radio" value="Management Report"> Mgt Rpt </p>
                                          <p style="text-indent: 75px">Report Name: <input name="ReportName" type="text" id="ReportName"></p>
                                          <p style="text-indent: 75px"><font face="Arial" size="2">Where is data located?</font>
                                        <input name="DataLocated" type="text" id="DataLocated"></p>
                                    <!--      <p style="text-indent: 75px">Date forwarded to IS
                                                <input name="DateForwardedToIS" type="text" id="DateForwardedToIS" onFocus="showCalendarControl(this);" >
                                          </p> -->      
                                     </span></font>       
                        </td>
            </tr>
            <tr>
              <td height="18" colspan="3"><p style="text-indent: 25px" ><font face="Arial" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        <input name="TypeOfRequest" type="radio" value="SharePoint"
                                          onClick="ShowSP(this,document.getElementById('RptDevRequest'));">
                        SharePoint Workspace</p>
                                    
                                    <span id="spSharepoint" style="display=none">
                                          <p style="text-indent: 75px">Purpose:
                                          <input name="spPurpose" type="text" id="spPurpose" size="40"></p>
                        <p style="text-indent: 75px">Short Name </font>       
                        <font face="Arial" size="1"><i>(20 characters)</i></font><font face="Arial" size="2">:
                        <input name="spShortName" type="text" id="spShortName" size="20" maxlength="20"></p>
                        <p style="text-indent: 75px">Full Name: <input name="SPlongName" type="text" id="SPlongName"></p>
                        <p style="text-indent: 75px">List all people using workspace by
                        their Role:</p>
                        <p style="text-indent: 75px">&nbsp;&nbsp;
                        Design: <input type="text" name="spDesignMembers" size="33"></p>
                        <p style="text-indent: 75px">&nbsp;&nbsp;
                        Contribute:
                        <input type="text" name="spContributeMembers" size="30"></p>
                        <p style="text-indent: 75px">&nbsp;&nbsp;
                        Read Only:
                        <input type="text" name="spReadOnlyMembers" size="30"></p>
                        <p style="text-indent: 75px">Type:
                                                </p>
                        <p style="text-indent: 75px">&nbsp;&nbsp;
                                                <input name="spType" type="radio" value="Permanent"
                                                onclick="
                               if (this.checked) {
                                 document.frmISRequest.spEndDate.value='';
                                 document.getElementById('spEndDateSpan').style.display='none';
                               } else {
                                 document.getElementById('spEndDateSpan').style.display='inline';
                               }
                               return true;"
                               onblur="if (this.checked) {
                                 document.frmISRequest.spEndDate.value='';
                                 document.getElementById('spEndDateSpan').style.display='none';
                               } else {
                                 document.getElementById('spEndDateSpan').style.display='inline';
                               }
                               return true;"
                                                > 
                                                Permanent<input name="spType" type="radio" value="Temporary"
                                                      onclick=" if (this.checked) {
                                 document.getElementById('spEndDateSpan').style.display='inline';
                                 document.frmISRequest.spEndDate.focus();
                               } else {
                                 document.getElementById('spEndDateSpan').style.display='none';
                               }
                               return true;"
                               onblur="if (this.checked) {
                                 document.getElementById('spEndDateSpan').style.display='inline';
                               } else {
                                 document.getElementById('spEndDateSpan').style.display='none';
                               }
                               return true;" >
                                                Temporary&nbsp; <span id="spEndDateSpan" style="display=none">End Date:  <input type="text" name="spEndDate" size="10" onFocus="showCalendarControl(this);"></span></p>
                                     </font>       
                                     </span>       
                        </td>
            </tr>
            <tr>
              <td height="18" colspan="2"><p style="text-indent: 25px"><font face="Arial" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        <input name="TypeOfRequest" type="radio" value="Other" onClick="HideISShowOther(this,document.getElementById('RptDevRequest'));">
                Other</font></p>
                         <span id="spOther" style="display=none"><font face="Arial" size="2">
                               <p style="text-indent: 75px">&nbsp;<input name="Other" type="text" id="Other"></p></font>
                         </span>
              </p></td>
              <td height="18">&nbsp;</td>
            </tr>
            
            <tr>
              <td height="18" colspan="3"></td>
            </tr>
            
            <tr>
              <td height="18" colspan="3">
                    <p style="text-indent: 25px"><strong><font face="Arial">Time Frame </font>                        </strong></td>
            </tr>
            
            <tr>
              <td width="25%" height="18">
                      <p align="left" style="text-indent: 25px"><font face="Arial" size="2">
                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        <input name="TimeFrame" type="radio" value="Urgent" >
                Urgent</font></td>
              <td width="27%" height="18"><div align="center">
                <input name="TimeFrame" type="radio" value="Soon" ><font face="Arial" size="2">
              Soon</font></div></td>
              <td width="48%"><font face="Arial" size="2"><input name="TimeFrame" type="radio" value="When Time Permits" >
              When Time Permits</font></td>
            </tr>
            
            <tr>
              <td width="25%" height="18">
                    <p style="text-indent: 25px"></td>
              <td height="18" colspan="2"></td>
            </tr>
            <tr>
              <td colspan="3" height="18"><p style="text-indent: 25px"><b><strong><font face="Arial">System Goal</font></strong></b></p></td>
            </tr>
            
            <tr>
              <td height="18" colspan="3"><p class="center"><font face="Arial" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font>Existing Program Name:
                <input name="strProgramName" type="text" size="30">
              </p> </td>
            </tr>
            
            <tr>
              <td width="25%" height="18">
                      <p style="text-indent: 25px"><font size="2" face="Arial">&nbsp;&nbsp;&nbsp;&nbsp; Description</font></td>
              <td height="18" colspan="2">&nbsp;</td>
            </tr>
            
            <tr>
              <td height="18" colspan="3">
                    
                      <textarea name="memDescription" cols="45" rows="20"></textarea>                    </td>
            </tr>
            
            <tr>
              <td height="18" colspan="3">                    </td>
            </tr>
          </table>
          <p align="center"><em>Information cannot be edited after clicking the &quot;Submit&quot; button below. </em></p>
          <p align="center">
      <input type="button" value="Print Preview" name="btnPreview" onClick="SendToPreviewPage()">
    <input type="button" value="Submit" name="B1" onClick="SendToProcessPage()">
<br>
<br><input type='button' value='Monday Test Submit' onclick='SubmitFormTest();'>

<input type='button' value='Monday Test Print Preview' onClick="SendToPreviewPageTest()">
  </p>
            </form>
***************************************************************************************
Remaining JavaScript the form calls to display/hide fields:
<SCRIPT language="JavaScript">
<!--
//Copies field value in Report Development Project Name into the Existing Program Name field further down the form OnBlur
function CopyValue() {
      v=document.frmISRequest.Project.value;
      document.frmISRequest.strProgramName.value=v;
}

// -->
</SCRIPT>

<SCRIPT language="JavaScript">
<!--
//Shows the report development related fields and positions the cursor in the Project textbox
function ShowIS(theCheckbox,theObject) {
            spOther.style.display='none';
            document.frmISRequest.Other.value="";
            document.frmISRequest.SPlongName.value="";
            document.frmISRequest.spPurpose.value="";
            document.frmISRequest.spShortName.value="";
            document.frmISRequest.spDesignMembers.value="";
            document.frmISRequest.spEndDate.value="";
            document.frmISRequest.spReadOnlyMembers.value="";
            document.frmISRequest.spType[0].checked=false;
            document.frmISRequest.spType[1].checked=false;
            spSharepoint.style.display='none';
            theObject.style.display='block';
            document.frmISRequest.Project.focus();
}
// -->
</SCRIPT>

<SCRIPT language="JavaScript">
<!--
//Hides the report development related fields and positions the cursor in the Project textbox
function HideIS(theCheckbox,theObject) {
            document.frmISRequest.Project.value="";      
            document.frmISRequest.ReportName.value="";
            document.frmISRequest.strProgramName.value="";
            document.frmISRequest.DataLocated.value="";      
            document.frmISRequest.SPlongName.value="";
            document.frmISRequest.spPurpose.value="";
            document.frmISRequest.spShortName.value="";
            document.frmISRequest.spContributeMembers.value="";
            document.frmISRequest.spDesignMembers.value="";
            document.frmISRequest.spEndDate.value="";
            document.frmISRequest.spReadOnlyMembers.value="";
            document.frmISRequest.spType[0].checked=false;
            document.frmISRequest.spType[1].checked=false;
            spSharepoint.style.display='none';
            //document.frmISRequest.DateForwardedToIS.value="";
            document.frmISRequest.reportType[0].checked=false;
            document.frmISRequest.reportType[1].checked=false;
            theObject.style.display='none';
            spOther.style.display='none';
            document.frmISRequest.Other.value="";
}
// -->
</SCRIPT>

<SCRIPT language="JavaScript">
<!--
//Hides the report development and other related fields, displays the Sharepoint fields, and positions the cursor in the Purpose textbox
function ShowSP(theCheckbox,theObject) {
            document.frmISRequest.Project.value="";      
            document.frmISRequest.ReportName.value="";
            document.frmISRequest.strProgramName.value="";
            document.frmISRequest.DataLocated.value="";      
            //document.frmISRequest.DateForwardedToIS.value="";
            document.frmISRequest.reportType[0].checked=false;
            document.frmISRequest.reportType[1].checked=false;
            theObject.style.display='none';
            spOther.style.display='none';
            document.frmISRequest.Other.value="";
            spSharepoint.style.display='block';
            document.frmISRequest.spPurpose.focus();
}
// -->
</SCRIPT>

<SCRIPT language="JavaScript">
<!--
//Hides the report development and SharePoint related fields and positions the cursor in the Other textbox
function HideISShowOther(theCheckbox,theObject) {
            document.frmISRequest.Project.value="";      
            document.frmISRequest.ReportName.value="";      
            document.frmISRequest.DataLocated.value="";      
            document.frmISRequest.strProgramName.value="";
            document.frmISRequest.SPlongName.value="";
            document.frmISRequest.spPurpose.value="";
            document.frmISRequest.spShortName.value="";
            document.frmISRequest.spContributeMembers.value="";
            document.frmISRequest.spDesignMembers.value="";
            document.frmISRequest.spEndDate.value="";
            document.frmISRequest.spReadOnlyMembers.value="";
            document.frmISRequest.spType[0].checked=false;
            document.frmISRequest.spType[1].checked=false;
            spSharepoint.style.display='none';
            //document.frmISRequest.DateForwardedToIS.value="";
            document.frmISRequest.reportType[0].checked=false;
            document.frmISRequest.reportType[1].checked=false;
            theObject.style.display='none';
            spOther.style.display='block';
            document.frmISRequest.Other.focus();
}
// -->
</SCRIPT>
<Script Language="JavaScript">
function displayReminder()
{
  alert("When requesting a new system or hardware purchase, be sure to attach a justification and/or business case to the IS Request Form before sending it to Lance.");
}
</Script>

ASKER CERTIFIED SOLUTION
Avatar of b0lsc0tt
b0lsc0tt
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of kjmay82

ASKER

b0lsc0tt:
I left this one line in the validation code
           document.frmISRequest.target='';
and it is working just as I wanted.  Thank you so very much!

Kathy
Your welcome!  I'm glad I could help.  Thanks for the grade, the points and the fun question.

bol