467,162 Members | 934 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,162 developers. It's quick & easy.

ARRAY issues

Hmmm, my array seems to be emptying itself for no reason. I just want to grab every form element posted to the page into an
appropriately sized array... What is going on here?

dim arrShort()
Elements = 0
dim frm
for each frm in Request.Form
Elements = Elements + 1
next

Redim Preserve arrShort(Elements)
xx = 0
for each frm in Request.Form
arrShort(xx) = frm & ": " & request.form(frm) & "<br>"
Response.Write("** " & arrShort(xx)) ' Works fine
next

' *** THIS PART BELOW ONLY HAS ONE ELEMENT POPULATED???
for q = 0 to UBound(arrShort)
Response.Write("VERIFY: " & arrShort(q)) ' Does not work for some reason
next

Thanks in advance!
Aug 9 '05 #1
  • viewed: 2214
Share:
19 Replies

"MMMMM" <no*****@replytogroup.com> wrote in message
news:Og**************@TK2MSFTNGP15.phx.gbl...
Hmmm, my array seems to be emptying itself for no reason. I just want to
grab every form element posted to the page into an appropriately sized
array... What is going on here?

dim arrShort()
Elements = 0
dim frm
for each frm in Request.Form
Elements = Elements + 1
next

Redim Preserve arrShort(Elements)
xx = 0
for each frm in Request.Form
arrShort(xx) = frm & ": " & request.form(frm) & "<br>"
Response.Write("** " & arrShort(xx)) ' Works fine
next

' *** THIS PART BELOW ONLY HAS ONE ELEMENT POPULATED???
for q = 0 to UBound(arrShort)
Response.Write("VERIFY: " & arrShort(q)) ' Does not work for some reason
next

Thanks in advance!

You forgot to increment xx in the for loop.
Aug 9 '05 #2
"Chris Hohmann" <no****@thankyou.com> wrote in message
news:u9**************@TK2MSFTNGP14.phx.gbl...

"MMMMM" <no*****@replytogroup.com> wrote in message
news:Og**************@TK2MSFTNGP15.phx.gbl...
Hmmm, my array seems to be emptying itself for no reason. I just want to
grab every form element posted to the page into an appropriately sized
array... What is going on here?

dim arrShort()
Elements = 0
dim frm
for each frm in Request.Form
Elements = Elements + 1
next

Redim Preserve arrShort(Elements)
xx = 0
for each frm in Request.Form
arrShort(xx) = frm & ": " & request.form(frm) & "<br>"
Response.Write("** " & arrShort(xx)) ' Works fine
next

' *** THIS PART BELOW ONLY HAS ONE ELEMENT POPULATED???
for q = 0 to UBound(arrShort)
Response.Write("VERIFY: " & arrShort(q)) ' Does not work for some reason
next

Thanks in advance!

You forgot to increment xx in the for loop.

Also note that when declaring/redeclaring an array, I believe the parameter
in the declaration statement represents the upper bound for the array, not
its size. As such, your array is one element too large. I know, it's not
intuitively obvious, but such is life in a world of zero-based arrays. :)
Aug 9 '05 #3
>> arrShort(xx) = frm & ": " & request.form(frm) & "<br>"
xx will always be 0. You need to increment xx - xx = xx+1
Response.Write("VERIFY: " & arrShort(q)) ' Does not work for some reason
What does "Does not work" mean?

Bob Lehmann

"MMMMM" <no*****@replytogroup.com> wrote in message
news:Og**************@TK2MSFTNGP15.phx.gbl... Hmmm, my array seems to be emptying itself for no reason. I just want to grab every form element posted to the page into an appropriately sized array... What is going on here?

dim arrShort()
Elements = 0
dim frm
for each frm in Request.Form
Elements = Elements + 1
next

Redim Preserve arrShort(Elements)
xx = 0
for each frm in Request.Form
arrShort(xx) = frm & ": " & request.form(frm) & "<br>"
Response.Write("** " & arrShort(xx)) ' Works fine
next

' *** THIS PART BELOW ONLY HAS ONE ELEMENT POPULATED???
for q = 0 to UBound(arrShort)
Response.Write("VERIFY: " & arrShort(q)) ' Does not work for some reason
next

Thanks in advance!

Aug 9 '05 #4
I am an idiot - An idiot operating on 3 hours of sleep ;-)

Thanks...

"Chris Hohmann" <no****@thankyou.com> wrote in message news:u9**************@TK2MSFTNGP14.phx.gbl...

"MMMMM" <no*****@replytogroup.com> wrote in message news:Og**************@TK2MSFTNGP15.phx.gbl...
Hmmm, my array seems to be emptying itself for no reason. I just want to grab every form element posted to the page into an
appropriately sized array... What is going on here?

dim arrShort()
Elements = 0
dim frm
for each frm in Request.Form
Elements = Elements + 1
next

Redim Preserve arrShort(Elements)
xx = 0
for each frm in Request.Form
arrShort(xx) = frm & ": " & request.form(frm) & "<br>"
Response.Write("** " & arrShort(xx)) ' Works fine
next

' *** THIS PART BELOW ONLY HAS ONE ELEMENT POPULATED???
for q = 0 to UBound(arrShort)
Response.Write("VERIFY: " & arrShort(q)) ' Does not work for some reason
next

Thanks in advance!

You forgot to increment xx in the for loop.

Aug 9 '05 #5
"MMMMM" wrote in message news:Og**************@TK2MSFTNGP15.phx.gbl...
: Hmmm, my array seems to be emptying itself for no reason. I just want to
grab every form element posted to the page into an
: appropriately sized array... What is going on here?
:
: dim arrShort()
: Elements = 0
: dim frm
: for each frm in Request.Form
: Elements = Elements + 1
: next
:
: Redim Preserve arrShort(Elements)
: xx = 0
: for each frm in Request.Form
: arrShort(xx) = frm & ": " & request.form(frm) & "<br>"
: Response.Write("** " & arrShort(xx)) ' Works fine
: next
:
: ' *** THIS PART BELOW ONLY HAS ONE ELEMENT POPULATED???
: for q = 0 to UBound(arrShort)
: Response.Write("VERIFY: " & arrShort(q)) ' Does not work for some reason
: next

A little less work:

<%@ Language=VBScript %>
<%
Option Explicit
Response.Buffer = True

sub lprt(str)
Response.Write str & "<br />" & vbCrLf
end sub

dim count, method, i, arrShort()
method = Request.ServerVariables("REQUEST_METHOD")
if method = "POST" then
count = Request.Form.Count
redim preserve arrShort(count - 1)
for i = 1 to count
arrShort(i - 1) = Request.Form.Key(i) & ": " & Request.Form.Item(i)
lprt "** " & arrShort(i - 1)
next
for i = 0 to ubound(arrShort)
lprt "VERIFY: " & arrShort(i)
next
end if
%>
<html>
<body>
<form action="" method="post">
<input type="text" name="t1" value="" /><br />
<input type="text" name="t2" value="" /><br />
<input type="submit" />
</form>
</body>
</html>

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
Aug 10 '05 #6
Roland Hall wrote:
A little less work:

<%@ Language=VBScript %>
<%
Option Explicit
Response.Buffer = True

sub lprt(str)
Response.Write str & "<br />" & vbCrLf
end sub

dim count, method, i, arrShort()
method = Request.ServerVariables("REQUEST_METHOD")
if method = "POST" then
count = Request.Form.Count
redim preserve arrShort(count - 1)
for i = 1 to count
arrShort(i - 1) = Request.Form.Key(i) & ": " & Request.Form.Item(i)
lprt "** " & arrShort(i - 1)
next
for i = 0 to ubound(arrShort)
lprt "VERIFY: " & arrShort(i)
next
end if


Even less work:

<%@Language=JScript%><%

var Elements = []
for (var i=1; i<=Request.Form.Count; i++)
Elements.push(Request.Form(i).Key + ": " + Request.Form(i).Item)

%>
--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
Aug 10 '05 #7
"Dave Anderson" wrote in message
news:eL**************@TK2MSFTNGP15.phx.gbl...
: Roland Hall wrote:
: > A little less work:
: >
: > <%@ Language=VBScript %>
: > <%
: > Option Explicit
: > Response.Buffer = True
: >
: > sub lprt(str)
: > Response.Write str & "<br />" & vbCrLf
: > end sub
: >
: > dim count, method, i, arrShort()
: > method = Request.ServerVariables("REQUEST_METHOD")
: > if method = "POST" then
: > count = Request.Form.Count
: > redim preserve arrShort(count - 1)
: > for i = 1 to count
: > arrShort(i - 1) = Request.Form.Key(i) & ": " & Request.Form.Item(i)
: > lprt "** " & arrShort(i - 1)
: > next
: > for i = 0 to ubound(arrShort)
: > lprt "VERIFY: " & arrShort(i)
: > next
: > end if
:
: Even less work:
:
: <%@Language=JScript%><%
:
: var Elements = []
: for (var i=1; i<=Request.Form.Count; i++)
: Elements.push(Request.Form(i).Key + ": " + Request.Form(i).Item)
:
: %>

Not much.

You're comparing that to:

dim i : redim preserve Elements(Request.Form.Count - 1)
for i = 1 to Request.Form.Count
Elements(i - 1) = Request.Form.Key(i) & ": " & Request.Form.Item(i)
next

....and in another language.

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
Aug 10 '05 #8
Roland Hall wrote:
Even less work:
...


Not much.

You're comparing that to:

dim i : redim preserve Elements(Request.Form.Count - 1)
for i = 1 to Request.Form.Count
Elements(i - 1) = Request.Form.Key(i) & ": " & Request.Form.Item(i)
next

...and in another language.


I am, indeed. And it is certainly less work to push an element onto an array
than to calculate the desired array size, resize that array, and keep track
of the array index (adjusting for the index offset, no less). The JScript
Array happily accepts whatever you give it. Size and index come for free.

[... And now for the BIG ASIDE ...]

In reality, I would not have used the construction in my example, as JScript
is far too interesting to stop there. A "step-through-the-collection"
approach might be:

for (var a=[],E=new Enumerator(Request.Form); !E.atEnd(); E.moveNext())
a.push({Name:E.item(),Value:Request.Form(E.item()) .Item})

This gives us an array of objects, each with [Name] and [Value] properties.
Now I can do interesting things, such as sort on [Name]:

a.sort(function(x,y){return x.Name<y.Name?-1:x.Name>y.Name?1:0})

Admittedly, this is of little advantage with a simple, always-available
object like the Request.Form collection. It is considerably more powerful
when used with recordsets, though:

for (var Employees=[]; !RS.EOF; RS.MoveNext()) a.push(
{
ID: RS.Fields("RecordID").Value,
Last: RS.Fields("LastName").Value,
First: RS.Fields("FirstName").Value,
SSN: RS.Fields("SSN").Value,
Phone: RS.Fields("PhoneNumber").Value,
Address: RS.Fields("PostalAddress").Value,
DOB: RS.Fields("DateOfBirth").Value,
Age: function(){return Math.floor((new Date() - new
Date(this.DOB))/31536000000)}
}
)
RS.Close()

In this case, the array takes the place of a disconnected recordset -- it is
a group of objects with enumerated properties (and methods, if desired!). I
can step forward and backward through it, sort it, insert elements, delete
others -- all without worrying about indices or whether I have the right
kind of cursor.

Best of all, it leads to *sensible* tokens for the HMTL templates:

<td><%=Employees[i].ID%></td>
<td><%=Employees[i].Last%></td>
<td><%=Employees[i].Age()%></td>

Stuff like that.
--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
Aug 10 '05 #9

"Dave Anderson" <GT**********@spammotel.com> wrote in message
news:u0**************@TK2MSFTNGP12.phx.gbl...
: Roland Hall wrote:
: >> Even less work:
: >> ...
: >
: > Not much.
: >
: > You're comparing that to:
: >
: > dim i : redim preserve Elements(Request.Form.Count - 1)
: > for i = 1 to Request.Form.Count
: > Elements(i - 1) = Request.Form.Key(i) & ": " & Request.Form.Item(i)
: > next
: >
: > ...and in another language.
:
: I am, indeed. And it is certainly less work to push an element onto an
array
: than to calculate the desired array size, resize that array, and keep
track
: of the array index (adjusting for the index offset, no less). The JScript
: Array happily accepts whatever you give it. Size and index come for free.

Terrific but the OP is using vbscript. I also could have responded in
Italian but he's using English.

: [... And now for the BIG ASIDE ...]
:
: In reality, I would not have used the construction in my example, as
JScript
: is far too interesting to stop there. A "step-through-the-collection"
: approach might be:
:
: for (var a=[],E=new Enumerator(Request.Form); !E.atEnd(); E.moveNext())
: a.push({Name:E.item(),Value:Request.Form(E.item()) .Item})
:
: This gives us an array of objects, each with [Name] and [Value]
properties.
: Now I can do interesting things, such as sort on [Name]:

Isn't that called an associative array? In VBScript we use a dictionary.

: a.sort(function(x,y){return x.Name<y.Name?-1:x.Name>y.Name?1:0})
:
: Admittedly, this is of little advantage with a simple, always-available
: object like the Request.Form collection. It is considerably more powerful
: when used with recordsets, though:
:
: for (var Employees=[]; !RS.EOF; RS.MoveNext()) a.push(
: {
: ID: RS.Fields("RecordID").Value,
: Last: RS.Fields("LastName").Value,
: First: RS.Fields("FirstName").Value,
: SSN: RS.Fields("SSN").Value,
: Phone: RS.Fields("PhoneNumber").Value,
: Address: RS.Fields("PostalAddress").Value,
: DOB: RS.Fields("DateOfBirth").Value,
: Age: function(){return Math.floor((new Date() - new
: Date(this.DOB))/31536000000)}
: }
: )
: RS.Close()

Why use recordset looping when you can use a 2-dimensional array?

: In this case, the array takes the place of a disconnected recordset -- it
is
: a group of objects with enumerated properties (and methods, if desired!).
I
: can step forward and backward through it, sort it, insert elements, delete
: others -- all without worrying about indices or whether I have the right
: kind of cursor.

I dump my recordset with GetRows into a 2-dimensional array and then close
and destroy the recordset and the connection. I find it to be pretty
powerful.

: Best of all, it leads to *sensible* tokens for the HMTL templates:
:
: <td><%=Employees[i].ID%></td>
: <td><%=Employees[i].Last%></td>
: <td><%=Employees[i].Age()%></td>

I normally don't mix my HTML and server-side script. I usually have just
one opening <% and one closing %> and if I was writing out a table, I would
use GetString.

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
Aug 11 '05 #10
Roland Hall wrote:
Why use recordset looping when you can use a 2-dimensional
array?
You might as well ask why we use column names with Recordsets or key names
when looking in Request.Form/QueryString collections. Each may be accessed
via index values, after all.
I dump my recordset with GetRows into a 2-dimensional array
and then close and destroy the recordset and the connection.
I find it to be pretty powerful.
I guess power is in the eye of the beholder.
Best of all, it leads to *sensible* tokens for the HMTL templates:

<td><%=Employees[i].ID%></td>
<td><%=Employees[i].Last%></td>
<td><%=Employees[i].Age()%></td>


I normally don't mix my HTML and server-side script.


I don't believe you.
I usually have just one opening <% and one closing %> and if
I was writing out a table, I would use GetString.


If you are writing a table, you are mixing HTML and server-side script,
since there is not concept of "table" in ASP.

--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
Aug 11 '05 #11

"Dave Anderson" <GT**********@spammotel.com> wrote in message
news:11*************@corp.supernews.com...
: Roland Hall wrote:
: > I dump my recordset with GetRows into a 2-dimensional array
: > and then close and destroy the recordset and the connection.
: > I find it to be pretty powerful.
:
: I guess power is in the eye of the beholder.

I guess.

: >> Best of all, it leads to *sensible* tokens for the HMTL templates:
: >>
: >> <td><%=Employees[i].ID%></td>
: >> <td><%=Employees[i].Last%></td>
: >> <td><%=Employees[i].Age()%></td>
: >
: > I normally don't mix my HTML and server-side script.
:
: I don't believe you.

You have no reason not to. When is the last time you caught me lying to
you? *raises eyebrow*

: > I usually have just one opening <% and one closing %> and if
: > I was writing out a table, I would use GetString.
:
: If you are writing a table, you are mixing HTML and server-side script,
: since there is not concept of "table" in ASP.

No, that's not true. Since you're being technical, server-side script and
HTML never mix. Server-side script knows nothing about HTML and vice versa.

What I'm saying is I do this:

<%
sub prt(str)
Response.Write str & vbCrLf
end sub

dim bbb
bbb = "boogie boogie boo"
prt "<span id=""thisID"">" & bbb & "</span>"

%>

not this:

<%
dim bbb
bbb = "boogie boogie boo"
%>
<span id="thisID"><%=bbb%></span>
<%

%>

.... but I'm getting to where I put my HTML in subroutines, using select case
and call them when I want them with:

sub writeHTML(s)
select case s
case "headOpen"
prt "<html>"
prt "<head>"
case "headClose"
...
end select
end sub

My inline code is usually minimal. I even have whole subroutines and
functions inside my toolbox in VS. And, I hardly ever use tables anymore.
Most of what I write is for functionality and not so much display.

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
Aug 11 '05 #12
Roland Hall wrote:
I normally don't mix my HTML and server-side script.

What I'm saying is I do this:

<%
sub prt(str)
Response.Write str & vbCrLf
end sub

dim bbb
bbb = "boogie boogie boo"
prt "<span id=""thisID"">" & bbb & "</span>"

%>


And that is mixing ASP with HTML -- in the worst way. The advantage of using
tokens is simple: The HTML template can be contiguous, and handled by
someone else with a completely different set of tools (like Dreamweaver).
Scripting actual tags is a nightmare for validation and maintenance
purposes, so we avoid it as much as possible.

In my environment, all server-side processing[1] occurs before a single line
of HTML is parsed. By the time the parser reaches the DOCTYPE declaration,
all of the output data is in variables[2], and all objects are out of scope
(which makes them available for GC in JScript).
not this:

<%
dim bbb
bbb = "boogie boogie boo"
%>
<span id="thisID"><%=bbb%></span>
<%

%>
....which I would never advocate anyway, since I do not mix processing and
rendering.
...I'm getting to where I put my HTML in subroutines, using
select case and call them when I want them with:

sub writeHTML(s)
select case s
case "headOpen"
prt "<html>"
prt "<head>"
case "headClose"
...
end select
end sub


I guess inelegance is its own reward. To each his own.


[1] Aside from simple conditionals and looping
[2] One variable, to be precise. Each page or gadget calls its own
constructor, to which properties are added in place of output variables. The
tokens, therefore, will look something like this:
<%=Page.Employees[i].LastName%>. Note that this enables an isomorphism
between the the data structure and the output.

--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
Aug 11 '05 #13
"Dave Anderson" wrote in message
news:Ok*************@TK2MSFTNGP09.phx.gbl...
: And that is mixing ASP with HTML -- in the worst way.

<drama>In the worst way?</drama>

: The advantage of using
: tokens is simple: The HTML template can be contiguous, and handled by
: someone else with a completely different set of tools (like Dreamweaver).

You have a flunky writing your client-side code that doesn't ever mix with
your server-side variables and yet you somehow pass those to the client?
That is impressive. Development by Osmosis. Sounds like the title to my
next article. Mind if I quote you?

I call Dreamweaver a stool, not a tool. What was that catchy phrase? Ah,
to each his own.

: Scripting actual tags is a nightmare for validation and maintenance
: purposes, so we avoid it as much as possible.

Which means you don't avoid it.

: In my environment, all server-side processing[1] occurs before a single
line
: of HTML is parsed.

Which means you have to put in ASP script blocks to pass values from the
server-side to the client.

: By the time the parser reaches the DOCTYPE declaration,
: all of the output data is in variables[2], and all objects are out of
scope
: (which makes them available for GC in JScript).

: > not this:
: >
: > <%
: > dim bbb
: > bbb = "boogie boogie boo"
: > %>
: > <span id="thisID"><%=bbb%></span>
: > <%
: >
: > %>
:
: ...which I would never advocate anyway, since I do not mix processing and
: rendering.

Which is what you do. There are only two ways to pass a server-side
variable to the client.

html<%=var%>html
Response.Write "html" & var & "html"

: I guess inelegance is its own reward. To each his own.

Better to be thought an ass than to write something like above and remove
all doubt.

: [2] One variable, to be precise. Each page or gadget calls its own
: constructor, to which properties are added in place of output variables.
The
: tokens, therefore, will look something like this:
: <%=Page.Employees[i].LastName%>. Note that this enables an isomorphism
: between the the data structure and the output.

Note is is a value passed from the server-side in the middle of your HTML.

Let's make it simple:

server-side variable: a
has a value of 1

It needs to be displayed on the client here: <div>My variable value is:
</div>

Show me another way other than what I listed. I love learning.

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
Aug 11 '05 #14
Roland Hall wrote:
The advantage of using tokens is simple: The HTML template
can be contiguous, and handled by someone else with a
completely different set of tools (like Dreamweaver).
You have a flunky writing your client-side code that doesn't
ever mix with your server-side variables and yet you somehow
pass those to the client?


There is nothing "flunky" about graphic designers. They possess skills that
neither you nor I do. It is arrogant and ignorant to assume they have
nothing to contribute to application design.

As for your shock and awe at the notion that different people can work on
the client-side and the server-side code, all I can say is, "Get over it".
People work collaberatively in a wide variety of settings every day. Web
development is one of those settings.
I call Dreamweaver a stool, not a tool. What was that catchy phrase?
Ah, to each his own.


How astute of you to seize upon my example. In truth, I don't know or care
what tools are used to produce the HTML templates for the applications. Nor
do I care what tool was used to create the graphics therein. The final
product is what matters. To each his own. Truly.
Scripting actual tags is a nightmare for validation and maintenance
purposes, so we avoid it as much as possible.


Which means you don't avoid it.


Absolutely correct. We have identified some tasks where it makes sense to
generate tags outside the templates.

One example is a method construct a set of <option> tags from any array. In
practice, the page constructor might contain something like this...

this.DeptList = Depts.toOptions(Request.Form("Department").Item)

....and the template would include this...

<select name="Department"><%=Page.DeptList%></select>

The template author need not worry about the contents of the <select>
element -- only the name of the control itself and the name of the token for
its contents.
In my environment, all server-side processing[1] occurs before
a single line of HTML is parsed.


Which means you have to put in ASP script blocks to pass values
from the server-side to the client.


Not quite. I use interlaced output to create a document. Flushing the buffer
sends the document to the client. Values are implicitly -- not explicitly --
passed to the client.

Honestly, Roland, I think you're a sloppy reader. I used the word "parsed"
because I meant "parsed". If I wanted to say "pass values to the client", I
would.
...which I would never advocate anyway, since I do not mix
processing and rendering.


Which is what you do.


No. You can play all the semantic games you want, but there are two clearly
different types of task you perform with an ASP script: those that directly
construct the output document, and those that do not. Examples of the first,
or "rendering" task:

<html>
<%=MyVar%>
Response.Write(MyVar)

Examples of the second, or "processing" task:

Server.CreateObject(...)
RS.MoveNext()

In almost all cases, it is possible to separate processing from rendering.

I suppose there is at least one special case - an act that has nothing to do
with constructing a document, but which cannot *usefully* be abstracted from
the processing portion: Response.Flush(). But in my experience, documents
that needs Response.Flush() are typically utility scripts, and as such are
not "templated".
--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
Aug 12 '05 #15
"Dave Anderson" wrote in message
news:Of**************@TK2MSFTNGP15.phx.gbl...
: Roland Hall wrote:
: >> The advantage of using tokens is simple: The HTML template
: >> can be contiguous, and handled by someone else with a
: >> completely different set of tools (like Dreamweaver).
: >
: > You have a flunky writing your client-side code that doesn't
: > ever mix with your server-side variables and yet you somehow
: > pass those to the client?
:
: There is nothing "flunky" about graphic designers. They possess skills
that
: neither you nor I do. It is arrogant and ignorant to assume they have
: nothing to contribute to application design.

You have no idea what my skills are re: graphic design, missy. A 'flunky'
is a subordinate and I said client-side code. I made no reference to a
graphic designer. Graphic designers are not usually flunkies to developers,
they're peers. The only difference in being a flunky for any industry is
whether you take direction or give it.

: As for your shock and awe at the notion that different people can work on
: the client-side and the server-side code, all I can say is, "Get over it".

Clearly that's not all you can say, as I see you're continuing.

: People work collaberatively in a wide variety of settings every day. Web
: development is one of those settings.

That's great but that doesn't happen in small shops and there are many more
small shops than there are large ones. Don't assume everyone's setup is
like yours.

: > I call Dreamweaver a stool, not a tool. What was that catchy phrase?
: > Ah, to each his own.
:
: How astute of you to seize upon my example. In truth, I don't know or care
: what tools are used to produce the HTML templates for the applications.
Nor
: do I care what tool was used to create the graphics therein. The final
: product is what matters. To each his own. Truly.

Then why choose something that is designed for non-developers as a variable
and then dismiss it when it's thrown back at you? I think you could take
both sides of the argument yourself and the rest of us could just read,
trying to follow along, but confused as ever, as the target seems to
constantly move.

: >> Scripting actual tags is a nightmare for validation and maintenance
: >> purposes, so we avoid it as much as possible.
: >
: > Which means you don't avoid it.
:
: Absolutely correct. We have identified some tasks where it makes sense to
: generate tags outside the templates.
:
: One example is a method construct a set of <option> tags from any array.
In
: practice, the page constructor might contain something like this...
:
: this.DeptList = Depts.toOptions(Request.Form("Department").Item)
:
: ...and the template would include this...
:
: <select name="Department"><%=Page.DeptList%></select>

And, in your previous post you said you never do that. Shame on your for
mixing ASP server tags in with your HTML. Oh wait, YOU never do it. Your
flunky does. (O:= I know, I know. It's what you're mixing, not HOW you're
mixing, although my first comment was HOW before the conversation went to
Hell.

: The template author need not worry about the contents of the <select>
: element -- only the name of the control itself and the name of the token
for
: its contents.

Token, schmoken. You're still mixing.

: >> In my environment, all server-side processing[1] occurs before
: >> a single line of HTML is parsed.
: >
: > Which means you have to put in ASP script blocks to pass values
: > from the server-side to the client.
:
: Not quite. I use interlaced output to create a document. Flushing the
buffer
: sends the document to the client. Values are implicitly -- not
explicitly --
: passed to the client.

'interlaced' ooh, aah, 'flushing' ooh, ahh, 'implictly' vs 'explicitly' ooh,
aah...
I'm setting up a cross-reference to refer to so when I read your posts I
know what the Hell you're talking about. Must be due to my sloppy reading
skills.

: Honestly, Roland, I think you're a sloppy reader. I used the word "parsed"
: because I meant "parsed". If I wanted to say "pass values to the client",
I
: would.

Slam count: 12
Actually I think you're too much in touch with your feminine side. Where
does all this emotion come from?

: >> ...which I would never advocate anyway, since I do not mix
: >> processing and rendering.
: >
: > Which is what you do.
:
: No. You can play all the semantic games you want, but there are two
clearly
: different types of task you perform with an ASP script: those that
directly
: construct the output document, and those that do not. Examples of the
first,
: or "rendering" task:
:
: . <html>
: . <%=MyVar%>
: . Response.Write(MyVar)

Never see code like that work but ok. I guess lines 1 and 2 should be read
separately from line 3. As Sarge would say in Quake III Arena, "Sloppy
soldier, sloppy!"

: Examples of the second, or "processing" task:
:
: . Server.CreateObject(...)
: . RS.MoveNext()

Considering I don't do recordset looping, I'm sloppily reading this and
missing it entirely.

: In almost all cases, it is possible to separate processing from rendering.
:
: I suppose there is at least one special case - an act that has nothing to
do
: with constructing a document, but which cannot *usefully* be abstracted
from
: the processing portion: Response.Flush(). But in my experience, documents
: that needs Response.Flush() are typically utility scripts, and as such are
: not "templated".

Perhaps you're just too smart for me Dave... or too emotional. I see it one
of two ways and you see a myriad yet you accuse me of bringing semantics to
the table.

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
Aug 12 '05 #16
Roland Hall "wrote":
You have no idea what my skills are re: graphic design, missy...


I can see you want to make this a personal issue rather than a discussion
centered on development. It has no further value in this forum.


--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
Aug 14 '05 #17
>> It has no further value in this forum.
Now, wait just one second......

There's nothing more entertaining than watching the unfolding of a pissing
match between two programmers splitting hairs on the minutiae of programming
style.

:>)

Bob Lehmann

"Dave Anderson" <GT**********@spammotel.com> wrote in message
news:11*************@corp.supernews.com...
Roland Hall "wrote":
You have no idea what my skills are re: graphic design, missy...
I can see you want to make this a personal issue rather than a discussion
centered on development. It has no further value in this forum.


--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message.

Use of this email address implies consent to these terms. Please do not contact me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.

Aug 14 '05 #18
"Bob Lehmann" <no****@dontbotherme.zzz> wrote in message
news:uv**************@TK2MSFTNGP12.phx.gbl...
: >> It has no further value in this forum.
: Now, wait just one second......
:
: There's nothing more entertaining than watching the unfolding of a pissing
: match between two programmers splitting hairs on the minutiae of
programming
: style.
:
::>)
:
: Bob Lehmann

(O:=

I think we have two separate conversations.

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp

Aug 15 '05 #19
"Dave Anderson" wrote in message news:11*************@corp.supernews.com...
: Roland Hall "wrote":
: > You have no idea what my skills are re: graphic design, missy...
:
: I can see you want to make this a personal issue rather than a discussion
: centered on development. It has no further value in this forum.

It probably reached that target on the 11th.

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
Aug 15 '05 #20

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Hamish Dean | last post: by
5 posts views Thread by Paulers | last post: by
8 posts views Thread by Pim75 | last post: by
3 posts views Thread by =?Utf-8?B?UmF5IE1pdGNoZWxs?= | last post: by
3 posts views Thread by =?Utf-8?B?SXpvcmljaA==?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.