Jump to content

How to stop <% %> tags being used as ASP tags?


louhours
 Share

Recommended Posts

I'm currently developing an internal tool which will allow users to make HTML forms via a website I've created. I'm currently learning ASP so I'm constantly having to find out ways of achieving certain goals, to gain my desired outcome.I have got my website ASP form creator working like a dream, which I'm very proud of having made it by myself. However I have hit a problem, of which I've not been able to find a work around for.The html form(s) contain tags (<% %>), these are used by my companies processing system. They are used as tokens to add the statistics into the forms. This presents me with a problem, as ASP uses the same identical tags.As I get the following error code:

Microsoft VBScript runtime error '800a01a8' Object required: ''

I know this is being caused by the <% %> tags. However I need these to still be present in the code and show on the final output, but not for the IIS to read them as ASP. I've tried covering them in certain ignore tags, however this fails to work.I've taken some the code out of the site to show below how it currently works;HTLM_Portal.asp

<%append=Request.Form("append")%><form action="output.asp" method="post"><input type="checkbox" name="append" value="Standard OSIS Telematching"<%if instr(append,"Standard OSIS Telematching") then Response.Write("checked")%>>Standard OSIS Telematching<input type="submit" value="Submit" /></form>

output.asp

<html><body><%append=request.form("append")if instr(append,"Standard OSIS Telematching") then%> <!--#include virtual ="/append/append21.inc"--><%end if%></body></html>

append21.inc

<center> <table border="1" cellpadding="" cellspacing="" width="600" align="center">   <TH bgcolor="62bb48"><font face="Arial Black" size="2" color="white"> STANDARD TELEMATCHING </TH> </TABLE>  <table border="1" cellpadding="" cellspacing="" width="600" align="center">   <TR>			   <td width="50%"><font face="Arial" size="2">Records In</td>      <td><font face="Arial" size="2">{RightJustify(<%Telematch.RecordsIn%>, 10, " ")}</td>   <td width=25%><font face="Arial" size="2"></td>  </TR>     <TR>	   <td width="50%"><font face="Arial" size="2">Tel Matches</td>      <td width="25%"><font face="Arial" size="2">{RightJustify(<%Telematch.GrandTotalNormalMatched%>, 10, " ")}</td>   <td width="25%"><font face="Arial" size="2">{Percent(<%Telematch.GrandTotalNormalMatched%>,<%Telematch.RecordsIn%>, 1)}</td>  </TR>	    <TR>	   <td width="50%"><font face="Arial" size="2">Unsearchable</td>      <td width="25%"><font face="Arial" size="2">{RightJustify(<%Telematch.Unsearchable%>, 10, " ")}</td>   <td width="25%"><font face="Arial" size="2">{Percent(<%Telematch.Unsearchable%>, <%Telematch.RecordsIn%>, 1)}<td>  </TR>   </TABLE>

As you can see in the append21.inc there are tokens like this

<%Telematch.RecordsIn%>

within the form. When these tokens are removed, the code then works correctly, creating the full form. However when these tags are present, the form throws up an error and breaks at that point in the code.My main question is whether or not there is either a way of ignoring specific tags such as <%Telematch.RecordsIn%> or whether there is another work around by maybe declaring them.Thanks in advance for any input.Lou

Edited by louhours
Link to comment
Share on other sites

Just print out the tags using ASP.
Thanks for the feedback Synook. I've worked out a way of getting the code to work using the ASP print method, by splitting the code up. As I found using the full tag even when using the ASP print method, this still through up an error.To help anyone else who ever might need a simular fix this is the code i used for the work around.append21.inc
1 <%2 Dim TelematchRecordsIn3 TelematchRecordsIn="%Telematch.RecordsIn%"4 %>56 <<%=TelematchRecordsIn%>>

Line 2 declares a variableLine 3 assigns the valueLine 6 prints the value (note the addtional <> tags used to get the complete desired tags)This will insert the code into the page as below (note this does not show in the browser for obvious reasons, however can be seen when viewing the source code).

<%Telematch.RecordsIn%>

RegardsLou

Edited by louhours
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...