Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CFERROR Problem 2

Status
Not open for further replies.

malleykr

Programmer
Mar 22, 2001
24
US
Hello.

I am trying to catch errors where there is a request timeout, so the user will be brought to a specific web page where they can email the correct support people, instead of showing them the default error screen with a link to the webmaster on it.

I am having a problem with part of the default error message showing up. Here is my code for the form on the error page:
Code:
<form action=&quot;../templates/user_got_error.cfm&quot; method=&quot;post&quot;>

	<textarea name=&quot;user_message&quot; rows=&quot;4&quot; cols=&quot;50&quot; wrap=&quot;virtual&quot;>Enter message:</textarea>
<br>
	<input type=&quot;hidden&quot; name=&quot;error_template&quot; value=&quot;#ERROR.Template#&quot;>
	<input type=&quot;hidden&quot; name=&quot;calling_page&quot; value=&quot;#ERROR.HTTPReferer#&quot;>
	<input type=&quot;hidden&quot; name=&quot;diagnostics&quot; value=&quot;#ERROR.Diagnostics#&quot;>
	<input type=&quot;hidden&quot; name=&quot;query_string&quot; value=&quot;#ERROR.QueryString#&quot;>
	<input type=&quot;hidden&quot; name=&quot;dateandtime&quot; value=&quot;#ERROR.DateTime#&quot;>
	<input type=&quot;hidden&quot; name=&quot;remote_address&quot; value=&quot;#ERROR.RemoteAddress#&quot;>
	<INPUT TYPE=&quot;Hidden&quot; NAME=&quot;H_gen&quot; VALUE=&quot;#error.generatedcontent#&quot;>
	<br><br></center>

<br>
	<input type=&quot;submit&quot; value=&quot;Send Message&quot;>

<br><br>
</form>


When the page comes up, it shows the text area field, then has the part of the error message displayed after it.

I have tried getting rid of the hidden variable &quot;Diagnostics&quot; and this solves the problem, but I want that information included in the email. Any one have any suggestions?

Thanks!
Kristen
 
Hey Kristen,

Try running all of your input variables through the replace() function to change quotation marks to &quot;&quot;&quot;. Otherwise, the browser sees the quotation mark and closes off the input tag pre-maturely. This happens when the data you're putting inside the value attribute contains a double quote. The browser sees this:

<input type=&quot;hidden&quot; name=&quot;diagnostics&quot;
value=&quot;The specific error is &quot;file not found&quot;.&quot;>

When it hits the first double quote, it considers that the end of the value section and just displays the remainder.

You'll want to do this on all of them but here's how to do the diagnostics input:

<input type=&quot;hidden&quot; name=&quot;diagnostics&quot;
value=&quot;#replace(ERROR.Diagnostics,&quot;&quot;&quot;&quot;,&quot;&quot;&quot;)#&quot;>

Hope this helps,
GJ
 
Actually, I found another way, right before I read your message. I used the URL_Encode() function to enclose the variable to prevent the problem you described.

Code:
<input type=&quot;hidden&quot; name=&quot;diagnostics&quot; value=&quot;#URL_Encode(ERROR.Diagnostics)#&quot;>[code][/color]

Thanks!!!
 
Hey Kristen,

Glad I could help somewhat :) Are you decoding the values on the action page with urldecode()? I would have thought they wouldn't come across readable if you run them through the urlencodedformat() function.

Take care,
GJ
 
Hi GJ.

Turns out I was in a bit of a rush to leave yesterday, so the only functionality I had time to test was to see if the error message disappeared from my email form.

I honestly cannot get either of our ideas to work (either the urlencodedformat or replace). I think the problem is stemming from the fact that the page I am sending the user to can only be HTML. The CF 4.5 language reference I have indicates that the page the user is sent to (for request errors) can only use the ERROR variables, and no CFML tags can be referenced on this page. That puts me in a bit of a bind. Any idea how I can handle this?

Thanks!
Kristen
 
Hey Kristen,

I think I see the problem then. I thought about it and the only think I can come up with at the moment is to put your variables inside <textarea> boxes. This won't be as nice but it's the only way I can think of to keep double quotes from interferring if you can't use any CF functions.

Try something like this:

<font color=&quot;white&quot;>
<textarea name=&quot;diagnostics&quot;>#ERROR.Diagnostics#</textarea>
</font>

By making the text white (or whatever your background color is), you should be able to keep the message from showing.

Let me know if it works,
GJ
 
GunJack,

Thanks, I did a little bit of a variation on your idea, and it should work pretty well. Here is the code I used:

Code:
<textarea name=&quot;diagnostics&quot; rows=&quot;4&quot; cols=&quot;50&quot; wrap=&quot;virtual&quot; readonly>#Error.Diagnostics#</textarea>

This way, the user sees it no matter what (preventing the strange occurance of seeing the text if they happen to highlight the area), but the readonly status will prevent the diagnostic information by being accidentally changed by the user.

Thanks a million!
Kristen
 
Glad I could help. I wasn't aware of the &quot;readonly&quot; attribute. That's a nice little tip although I wonder if it works in all browsers.

Take care,
GJ
 
It is too bad, but READONLY only works for IE.

heh, don't act surprised

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top