Response Buffer Limit Exceeded??? - Posted (1680 Views)
DEV Team Forum Moderator
Da_Stimulator
Posts: 3373
3373
Hi, long time no see ppl

so... I'm writing a web app to show product listing, and I just added categories to that app.
I added this little chunk of code and it threw an error at me, Response buffer limit exceeded? never seen that one before, and I dont see any errors in my code, AND there is only ONE category in the database at the moment. Help?
Code:

set crs = Server.CreateObject("Adodb.RecordSet")
strsql = "SELECT Cat_Name, Cat_ID FROM P_Categories ORDER BY Cat_Name ASC"
crs.Open strsql, dbConn
if not(crs.eof) then
Do while not(crs.eof)
response.write("<option value=""" & crs("Cat_ID"))
if crs("Cat_ID") = strProductCat then
response.write(" SELECTED")
end if
response.write(""">" & formatString(crs("Cat_Name")) & "</option>")
Loop
else
response.write("<option value=""0"">No Categories Found!!!</option>")
end if
crs.close
set crs = nothing

I should note that the page worked flawlessly till I added that code ^^

*edit - Response.Buffer=False produced no error, however it also produced NO PAGE... no source, nothing. just a blank browser screen.
I commented out the added code with the same result... so now I dont even know if it's that code or what. The only other things I edited were a couple of SQL statements that shouldn't even be called the way the page is loading...
*edit again - ok I did a process of elimination and the code above IS whats causing the error...<
-Stim
 Sort direction, for dates DESC means newest first  
 Page size 
Posted
Forum Admin
HuwR
Posts: 20611
20611
you will never exit the loop since you are not doing a movenext on the recordset.movenext, so you only ever check the same record over and over again. <
Posted
DEV Team Forum Moderator
Da_Stimulator
Posts: 3373
3373
... something stupid, i knew it.
Thx Huw<
-Stim
Posted
Average Member
SiSL
Posts: 671
671
Or you may simple use GetRows and close Recordset and go with For ... Next on array, which I find less dangerous and less resource demand in most cases.<
Posted
DEV Team Forum Moderator
Da_Stimulator
Posts: 3373
3373
I could do that, and I might if this ends up getting big enough to be worried about resources. This is in extremely early development... as I havnt coded for probably 2 or 3 years... its been a while, I find I have to re-learn alot of things.
Like basic f'in HTML for example... lol

If I remember correctly if I had the following HTML code:
Code:

<select name="whatever">
<option value="this">This</option>
<option value="that">That</option>
<option value="select me!" selected>Select Me!</option>
</select>

Then the "Select Me!" would be automatically selected... but apparently thats not the case! Not in firefox anyway... I've tried the above, I've tried <option value="whatev" selected="selected"> and neither seem to work. I've tried capitalized, lowercase, I just dont get it. I DO remember it working...<
-Stim
Posted
Advanced Member
Carefree
Posts: 4224
4224
Try "option selected value"
In Firefox, you have to use option value selected="yes", thus:

<select name="whatever">
<option value="this">This</option>
<option value="that">That</option>
<option value="select me!" selected="yes">Select Me!</option>
</select>
<
Posted
Forum Moderator
AnonJr
Posts: 5768
5768
Looks like it should be <option value="whatever" selected="selected"> based on http://www.w3schools.com/tags/att_option_selected.asp<
Posted
Advanced Member
Carefree
Posts: 4224
4224
I tested it with Firefox 3 and selected="yes" works just fine.<
Posted
Forum Moderator
AnonJr
Posts: 5768
5768
If it works it works. However I've only seen it documented one of two ways - <option value="whatever" selected> and <option value="whatever" selected="selected">
The former in the fun days before XHTML, and the latter as a part of XHTML. What works is most likely going to be based partly on the DOCTYPE set and how closely the browser conforms to the standard and/or tries to "help" by guessing what you meant.<
Posted
Average Member
SiSL
Posts: 671
671
Firefox does not care about standards nor DOCTYPE at all, so it should work regardless doctype. However selected="selected" should be better option. If it does not work in Firefox, it should not work at any browser as well, which is most likely "not matching" any records.

In your case: crs("Cat_ID") = strProductCat, you can try cLng(crs("Cat_ID")) = cLng(strProductCat) or lcase(crs("Cat_ID")) = lcase(strProductCat)

I suggest to view source codes on browser via "View source" etc. to see what's going wrong there.<
Posted
DEV Team Forum Moderator
Da_Stimulator
Posts: 3373
3373
ok, so using selected="yes" works (in firefox)

is that universal? does the same thing also work in IE, Opera, etc? or do I need to add browser detection and have 3 sets of code?<
-Stim
You Must enter a message