Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_web_howto thread: Form.Action = "FunctionName()" in a .inc file


Message #1 by "Anthony Delcy" <DELCYAN@l...> on Mon, 23 Apr 2001 10:01:30 -0400
Hello,



It seems that I cannot put the following line in  an .inc file but the 

same logic works fine in an .html file.



Could someone explain why this phenomenon is happenning.



See my code below.



Thank you



Anthony



<html>

<HEAD>

<title>NEW GTR NUMBER</title>=09

<SCRIPT language=3D"javascript"><!--function addNewOption(objSelect) {  

var optionNo =3D 0;  optionNo +=3D 1;  oNewOption =3D new Option();  

oNewOption.text =3D "Option " + optionNo;  objSelect.add(oNewOption, 

1);}// --></SCRIPT>

</HEAD>

<body onload=3D"MainFunct()">

<LINK href=3D"GTR.css" rel=3Dstylesheet type=3Dtext/css>

<center>

  <form name=3D"frmGTR" method=3D"post" action=3D"VerifyGTR()">

    <table width=3D"600" height=3D"182">

      <tr valign=3D"top" align=3D"left">

     

      </tr>     

		</table>

        

          <table bgcolor=3D"white" width=3D"400">

            <tr>

              <td>                

                <table class=3D"tbl" width=3D"457" cellpadding=3D"0" 

cellspacing=3D"0" border=3D"1" bordercolor=3D"steelblue" rules=3D"none">

                	<tr bgcolor=3D"steelblue">

						<th colspan=3D"3" 

class=3D"tblhdr">GTR Details</th>

					</tr>

                  <tr>

					<td width=3D"5"></td>

					<td NOWRAP><STRONG>Report 

#</STRONG> </td>

					<td>

					<input class=3D"editfld " 

maxlength=3D"14" size=3D"30" id=3D"reportnumber" name=3D"reportnumber" 

readOnly style=3D"BORDER-LEFT-STYLE: none; BORDER-TOP-STYLE: none"> 

					<INPUT class=3D"editfld " 

id=3DDBCreatedby maxLength=3D14 name=3DDBCreatedby readOnly size=3D30 

style=3D"BORDER-LEFT-STYLE: none; BORDER-TOP-STYLE: none; HEIGHT: 17px; 

VISIBILITY: hidden; WIDTH: 55px">

					</td>

				  </tr>

				  <tr>

					<td></td>

					<td NOWRAP><FONT color=3Dfirebrick>

<STRONG>Title</STRONG></FONT></td>

					<td>

					<input class=3D"editfld " 

maxlength=3D"40" size=3D"80" id=3D"title" name=3D"title" >

					</td>

				  </tr>

                  <tr>

				  <td></td>

					<td NOWRAP><STRONG>Product 

#</STRONG> </td>

					<td>

					<input class=3D"editfld " 

maxlength=3D"40" size=3D"80" id=3D"product" name=3D"product" >

					</td>

				  </tr>

				  <tr>

					<td></td>

					<td NOWRAP><STRONG>TDPR #</STRONG> 

</td>

					<td>

					<input class=3D"editfld " 

maxlength=3D"40" size=3D"80" id=3D"tdpr" name=3D"tdpr" >

					</td>

				  </tr>

				  <tr>

					<td></td>

					<td NOWRAP><STRONG>Project 

#</STRONG> </td>

					<td>

					<input class=3D"editfld " 

maxlength=3D"40" size=3D"80" id=3D"projectnumber" name=3D"projectnumber" >

					</td>

				  </tr>

				  <tr>

					<td></td>

					<td NOWRAP><STRONG>Purpose</STRONG>

 </td>

					<td><TEXTAREA class=3Deditfld 

cols=3D50 id=3Dpurpose name=3Dpurpose rows=3D3 style=3D"HEIGHT: 45px; 

WIDTH: 421px" MAXLENGTH=3D"200"></TEXTAREA>				

=09

					</td>

				  </tr>

				  <tr>

					<td></td>

					<td NOWRAP><STRONG>Change Control 

#</STRONG>  </td>

					<td>

					<input class=3D"editfld " 

maxlength=3D"40" size=3D"80" id=3D"changecontrol" name=3D"changecontrol" 

style=3D"HEIGHT: 19px; WIDTH: 422px">

					</td>

				  </tr>                

                  <tr>

					<td></td>

					<td NOWRAP><STRONG><FONT

            color=3Dfirebrick>Section Code</FONT> </STRONG>  </td>

					<td>

					<SELECT class=3D"editfld " 

name=3D"sectioncode" style=3D"HEIGHT: 22px; WIDTH: 67px">

					   <OPTION value=3DD selected>

					   <OPTION value=3DD>D

					   <OPTION value=3DP>P

					   <OPTION value=3DS>S

					   <OPTION value=3DV>V

					   </OPTION>

					</SELECT>                    

                    <input class=3D"butn" type=3D"submit" name=3D"Submit" 

value=3D"Submit">					 

					</td>

				  </tr>                                 



                 

                </table>

              </td>

            </tr>

          </table></TR></TABLE>



</form>



</center>



</body>

</html>



<script language=3D"VBscript">

=09

	Sub MainFunct()

					=09

		if <%=3DRequest.Form("UserName") =3D "" or Request.Form("Pa

ssword") =3D ""%> then

			window.location =3D "Redirect.asp"

		else		=09

			document.all.DBCreatedby.value =3D "<%=3DRequest.Fo

rm("UserName")%>"

		end if

	End sub

	Sub VerifyGTR()

					=09

		if document.all.sectioncode.value  =3D "" then

			alert("You must select a Section Code from the 

list")

		else

			frmGTR.action =3D "GTRInsert.asp"=09

		end if

	End sub=09

</script>





Message #2 by "Alex Shiell, ITS, EC, SE" <alex.shiell@s...> on Tue, 24 Apr 2001 09:47:52 +0100
html files cannot use inc - its got to be an ASP



-----Original Message-----

From: Anthony Delcy [mailto:DELCYAN@l...]

Sent: Monday, April 23, 2001 3:02 PM

To: ASP Web HowTo

Subject: [asp_web_howto] Form.Action = "FunctionName()" in a .inc file





Hello,



It seems that I cannot put the following line in  an .inc file but the same

logic works fine in an .html file.



Could someone explain why this phenomenon is happenning.



See my code below.



Thank you



Anthony



<html>

<HEAD>

<title>NEW GTR NUMBER</title>	

<SCRIPT language="javascript"><!--function addNewOption(objSelect) {  var

optionNo = 0;  optionNo += 1;  oNewOption = new Option();  oNewOption.text 

"Option " + optionNo;  objSelect.add(oNewOption, 1);}// --></SCRIPT>

</HEAD>

<body onload="MainFunct()">

<LINK href="GTR.css" rel=stylesheet type=text/css>

<center>

  <form name="frmGTR" method="post" action="VerifyGTR()">

    <table width="600" height="182">

      <tr valign="top" align="left">

      

      </tr>      

		</table> 

         

          <table bgcolor="white" width="400">

            <tr> 

              <td>                 

                <table class="tbl" width="457" cellpadding="0"

cellspacing="0" border="1" bordercolor="steelblue" rules="none">

                	<tr bgcolor="steelblue">

						<th colspan="3"

class="tblhdr">GTR Details</th>

					</tr> 

                  <tr>

					<td width="5"></td>

					<td NOWRAP><STRONG>Report #</STRONG>

</td>

					<td>

					<input class="editfld "

maxlength="14" size="30" id="reportnumber" name="reportnumber" readOnly

style="BORDER-LEFT-STYLE: none; BORDER-TOP-STYLE: none"> 

					<INPUT class="editfld "

id=DBCreatedby maxLength=14 name=DBCreatedby readOnly size=30

style="BORDER-LEFT-STYLE: none; BORDER-TOP-STYLE: none; HEIGHT: 17px;

VISIBILITY: hidden; WIDTH: 55px">

					</td>

				  </tr>

				  <tr>

					<td></td>

					<td NOWRAP><FONT

color=firebrick><STRONG>Title</STRONG></FONT></td>

					<td>

					<input class="editfld "

maxlength="40" size="80" id="title" name="title" >

					</td>

				  </tr>

                  <tr>

				  <td></td>

					<td NOWRAP><STRONG>Product

#</STRONG> </td>

					<td>

					<input class="editfld "

maxlength="40" size="80" id="product" name="product" >

					</td>

				  </tr>

				  <tr>

					<td></td>

					<td NOWRAP><STRONG>TDPR #</STRONG>

</td>

					<td>

					<input class="editfld "

maxlength="40" size="80" id="tdpr" name="tdpr" >

					</td>

				  </tr>

				  <tr>

					<td></td>

					<td NOWRAP><STRONG>Project

#</STRONG> </td>

					<td>

					<input class="editfld "

maxlength="40" size="80" id="projectnumber" name="projectnumber" >

					</td>

				  </tr>

				  <tr>

					<td></td>

					<td NOWRAP><STRONG>Purpose</STRONG>

</td>

					<td><TEXTAREA class=editfld cols=50

id=purpose name=purpose rows=3 style="HEIGHT: 45px; WIDTH: 421px"

MAXLENGTH="200"></TEXTAREA>					

					</td>

				  </tr>

				  <tr>

					<td></td>

					<td NOWRAP><STRONG>Change Control

#</STRONG>  </td>

					<td>

					<input class="editfld "

maxlength="40" size="80" id="changecontrol" name="changecontrol"

style="HEIGHT: 19px; WIDTH: 422px">

					</td>

				  </tr>                 

                  <tr>

					<td></td>

					<td NOWRAP><STRONG><FONT 

            color=firebrick>Section Code</FONT> </STRONG>  </td>

					<td>

					<SELECT class="editfld "

name="sectioncode" style="HEIGHT: 22px; WIDTH: 67px"> 

					   <OPTION value=D selected>

					   <OPTION value=D>D

					   <OPTION value=P>P

					   <OPTION value=S>S

					   <OPTION value=V>V

					   </OPTION>

					</SELECT>                     

                    <input class="butn" type="submit" name="Submit"

value="Submit">					  

					</td>

				  </tr>                                  

                  

                </table>

              </td>

            </tr>

          </table></TR></TABLE>



</form>



</center>



</body>

</html>



<script language="VBscript">

	

	Sub MainFunct()

						

		if <%=Request.Form("UserName") = "" or

Request.Form("Password") = ""%> then

			window.location = "Redirect.asp"

		else			

			document.all.DBCreatedby.value 

"<%=Request.Form("UserName")%>"

		end if

	End sub

	Sub VerifyGTR()

						

		if document.all.sectioncode.value  = "" then

			alert("You must select a Section Code from the

list")

		else

			frmGTR.action = "GTRInsert.asp"	

		end if

	End sub	

</script>

________________________________________________________________________

Scottish Enterprise Network

http://www.scottish-enterprise.com

Message #3 by "Anthony Delcy" <DELCYAN@l...> on Tue, 24 Apr 2001 10:22:35 -0400
Please take a look at the code.

All I am trying to do is get the form.action to call a function and in 

that function I verify whether something is fine and if it is, then I will 

assign the form.action to a .asp file.



The problem is that it works in an .html but gives an error when I do the 

logic in an .inc file.



Could someone tell me what I am doing wrong.



Thank you



Anthony





>>> "Alex Shiell, ITS, EC, SE" <alex.shiell@s...> 04/24 4:47 AM 

>>>

html files cannot use inc - its got to be an ASP



-----Original Message-----

From: Anthony Delcy [mailto:DELCYAN@l...]

Sent: Monday, April 23, 2001 3:02 PM

To: ASP Web HowTo

Subject: [asp_web_howto] Form.Action =3D "FunctionName()" in a .inc file





Hello,



It seems that I cannot put the following line in  an .inc file but the 

same

logic works fine in an .html file.



Could someone explain why this phenomenon is happenning.



See my code below.



Thank you



Anthony



<html>

<HEAD>

<title>NEW GTR NUMBER</title>=09

<SCRIPT language=3D"javascript"><!--function addNewOption(objSelect) {  

var

optionNo =3D 0;  optionNo +=3D 1;  oNewOption =3D new Option();  oNewOption

.text =3D

"Option " + optionNo;  objSelect.add(oNewOption, 1);}// --></SCRIPT>

</HEAD>

<body onload=3D"MainFunct()">

<LINK href=3D"GTR.css" rel=3Dstylesheet type=3Dtext/css>

<center>

  <form name=3D"frmGTR" method=3D"post" action=3D"VerifyGTR()">

    <table width=3D"600" height=3D"182">

      <tr valign=3D"top" align=3D"left">

     

      </tr>     

		</table>

        

          <table bgcolor=3D"white" width=3D"400">

            <tr>

              <td>                

                <table class=3D"tbl" width=3D"457" cellpadding=3D"0"

cellspacing=3D"0" border=3D"1" bordercolor=3D"steelblue" rules=3D"none">

                	<tr bgcolor=3D"steelblue">

						<th colspan=3D"3"

class=3D"tblhdr">GTR Details</th>

					</tr>

                  <tr>

					<td width=3D"5"></td>

					<td NOWRAP><STRONG>Report 

#</STRONG>

</td>

					<td>

					<input class=3D"editfld "

maxlength=3D"14" size=3D"30" id=3D"reportnumber" name=3D"reportnumber" 

readOnly

style=3D"BORDER-LEFT-STYLE: none; BORDER-TOP-STYLE: none"> 

					<INPUT class=3D"editfld "

id=3DDBCreatedby maxLength=3D14 name=3DDBCreatedby readOnly size=3D30

style=3D"BORDER-LEFT-STYLE: none; BORDER-TOP-STYLE: none; HEIGHT: 17px;

VISIBILITY: hidden; WIDTH: 55px">

					</td>

				  </tr>

				  <tr>

					<td></td>

					<td NOWRAP><FONT

color=3Dfirebrick><STRONG>Title</STRONG></FONT></td>

					<td>

					<input class=3D"editfld "

maxlength=3D"40" size=3D"80" id=3D"title" name=3D"title" >

					</td>

				  </tr>

                  <tr>

				  <td></td>

					<td NOWRAP><STRONG>Product

#</STRONG> </td>

					<td>

					<input class=3D"editfld "

maxlength=3D"40" size=3D"80" id=3D"product" name=3D"product" >

					</td>

				  </tr>

				  <tr>

					<td></td>

					<td NOWRAP><STRONG>TDPR #</STRONG>

</td>

					<td>

					<input class=3D"editfld "

maxlength=3D"40" size=3D"80" id=3D"tdpr" name=3D"tdpr" >

					</td>

				  </tr>

				  <tr>

					<td></td>

					<td NOWRAP><STRONG>Project

#</STRONG> </td>

					<td>

					<input class=3D"editfld "

maxlength=3D"40" size=3D"80" id=3D"projectnumber" name=3D"projectnumber" >

					</td>

				  </tr>

				  <tr>

					<td></td>

					<td NOWRAP><STRONG>Purpose</STRONG>



</td>

					<td><TEXTAREA class=3Deditfld 

cols=3D50

id=3Dpurpose name=3Dpurpose rows=3D3 style=3D"HEIGHT: 45px; WIDTH: 421px"

MAXLENGTH=3D"200"></TEXTAREA>				=09

					</td>

				  </tr>

				  <tr>

					<td></td>

					<td NOWRAP><STRONG>Change Control

#</STRONG>  </td>

					<td>

					<input class=3D"editfld "

maxlength=3D"40" size=3D"80" id=3D"changecontrol" name=3D"changecontrol"

style=3D"HEIGHT: 19px; WIDTH: 422px">

					</td>

				  </tr>                

                  <tr>

					<td></td>

					<td NOWRAP><STRONG><FONT

            color=3Dfirebrick>Section Code</FONT> </STRONG>  </td>

					<td>

					<SELECT class=3D"editfld "

name=3D"sectioncode" style=3D"HEIGHT: 22px; WIDTH: 67px">

					   <OPTION value=3DD selected>

					   <OPTION value=3DD>D

					   <OPTION value=3DP>P

					   <OPTION value=3DS>S

					   <OPTION value=3DV>V

					   </OPTION>

					</SELECT>                    

                    <input class=3D"butn" type=3D"submit" name=3D"Submit"

value=3D"Submit">					 

					</td>

				  </tr>                                 



                 

                </table>

              </td>

            </tr>

          </table></TR></TABLE>



</form>



</center>



</body>

</html>



<script language=3D"VBscript">

=09

	Sub MainFunct()

					=09

		if <%=3DRequest.Form("UserName") =3D "" or

Request.Form("Password") =3D ""%> then

			window.location =3D "Redirect.asp"

		else		=09

			document.all.DBCreatedby.value =3D

"<%=3DRequest.Form("UserName")%>"

		end if

	End sub

	Sub VerifyGTR()

					=09

		if document.all.sectioncode.value  =3D "" then

			alert("You must select a Section Code from the

list")

		else

			frmGTR.action =3D "GTRInsert.asp"=09

		end if

	End sub=09

</script>



Message #4 by "George Draper" <georgedraper@m...> on Tue, 24 Apr 2001 11:38:38 -0400
I don't know if this could be it but, an include file with any functions

must be before the call to the function.  Does it work if the page is .asp

and the include file code is pasted in instead of called as an include?



- George



-----Original Message-----

From: Anthony Delcy <DELCYAN@l...>

To: ASP Web HowTo <asp_web_howto@p...>

Date: Tuesday, April 24, 2001 10:28 AM

Subject: [asp_web_howto] RE: Form.Action = "FunctionName()" in a .inc file





Please take a look at the code.

All I am trying to do is get the form.action to call a function and in that

function I verify whether something is fine and if it is, then I will assign

the form.action to a .asp file.



The problem is that it works in an .html but gives an error when I do the

logic in an .inc file.



Could someone tell me what I am doing wrong.



Thank you



Anthony





>>> "Alex Shiell, ITS, EC, SE" <alex.shiell@s...> 04/24 4:47 AM >>>

html files cannot use inc - its got to be an ASP



-----Original Message-----

From: Anthony Delcy [mailto:DELCYAN@l...]

Sent: Monday, April 23, 2001 3:02 PM

To: ASP Web HowTo

Subject: [asp_web_howto] Form.Action = "FunctionName()" in a .inc file





Hello,



It seems that I cannot put the following line in  an .inc file but the same

logic works fine in an .html file.



Could someone explain why this phenomenon is happenning.



See my code below.



Thank you



Anthony



<html>

<HEAD>

<title>NEW GTR NUMBER</title>

<SCRIPT language="javascript"><!--function addNewOption(objSelect) {  var

optionNo = 0;  optionNo += 1;  oNewOption = new Option();  oNewOption.text 

"Option " + optionNo;  objSelect.add(oNewOption, 1);}// --></SCRIPT>

</HEAD>

<body onload="MainFunct()">

<LINK href="GTR.css" rel=stylesheet type=text/css>

<center>

  <form name="frmGTR" method="post" action="VerifyGTR()">

    <table width="600" height="182">

      <tr valign="top" align="left">



      </tr>

</table>



          <table bgcolor="white" width="400">

            <tr>

              <td>

                <table class="tbl" width="457" cellpadding="0"

cellspacing="0" border="1" bordercolor="steelblue" rules="none">

                <tr bgcolor="steelblue">

<th colspan="3"

class="tblhdr">GTR Details</th>

</tr>

                  <tr>

<td width="5"></td>

<td NOWRAP><STRONG>Report #</STRONG>

</td>

<td>

<input class="editfld "

maxlength="14" size="30" id="reportnumber" name="reportnumber" readOnly

style="BORDER-LEFT-STYLE: none; BORDER-TOP-STYLE: none"> 

<INPUT class="editfld "

id=DBCreatedby maxLength=14 name=DBCreatedby readOnly size=30

style="BORDER-LEFT-STYLE: none; BORDER-TOP-STYLE: none; HEIGHT: 17px;

VISIBILITY: hidden; WIDTH: 55px">

</td>

  </tr>

  <tr>

<td></td>

<td NOWRAP><FONT

color=firebrick><STRONG>Title</STRONG></FONT></td>

<td>

<input class="editfld "

maxlength="40" size="80" id="title" name="title" >

</td>

  </tr>

                  <tr>

  <td></td>

<td NOWRAP><STRONG>Product

#</STRONG> </td>

<td>

<input class="editfld "

maxlength="40" size="80" id="product" name="product" >

</td>

  </tr>

  <tr>

<td></td>

<td NOWRAP><STRONG>TDPR #</STRONG>

</td>

<td>

<input class="editfld "

maxlength="40" size="80" id="tdpr" name="tdpr" >

</td>

  </tr>

  <tr>

<td></td>

<td NOWRAP><STRONG>Project

#</STRONG> </td>

<td>

<input class="editfld "

maxlength="40" size="80" id="projectnumber" name="projectnumber" >

</td>

  </tr>

  <tr>

<td></td>

<td NOWRAP><STRONG>Purpose</STRONG>

</td>

<td><TEXTAREA class=editfld cols=50

id=purpose name=purpose rows=3 style="HEIGHT: 45px; WIDTH: 421px"

MAXLENGTH="200"></TEXTAREA>

</td>

  </tr>

  <tr>

<td></td>

<td NOWRAP><STRONG>Change Control

#</STRONG>  </td>

<td>

<input class="editfld "

maxlength="40" size="80" id="changecontrol" name="changecontrol"

style="HEIGHT: 19px; WIDTH: 422px">

</td>

  </tr>

                  <tr>

<td></td>

<td NOWRAP><STRONG><FONT

            color=firebrick>Section Code</FONT> </STRONG>  </td>

<td>

<SELECT class="editfld "

name="sectioncode" style="HEIGHT: 22px; WIDTH: 67px">

   <OPTION value=D selected>

   <OPTION value=D>D

   <OPTION value=P>P

   <OPTION value=S>S

   <OPTION value=V>V

   </OPTION>

</SELECT>

                    <input class="butn" type="submit" name="Submit"

value="Submit">

</td>

  </tr>



                </table>

              </td>

            </tr>

          </table></TR></TABLE>



</form>



</center>



</body>

</html>



<script language="VBscript">



Sub MainFunct()



if <%=Request.Form("UserName") = "" or

Request.Form("Password") = ""%> then

window.location = "Redirect.asp"

else

document.all.DBCreatedby.value 

"<%=Request.Form("UserName")%>"

end if

End sub

Sub VerifyGTR()



if document.all.sectioncode.value  = "" then

alert("You must select a Section Code from the

list")

else

frmGTR.action = "GTRInsert.asp"

end if

End sub

</script>




  Return to Index