"Rob Meade" wrote in message
news:0%******************@text.news.blueyonder.co. uk...
: "Morris" wrote ...
:
: > This may not be possible on the server side, so apologies if this is the
: wrong group for this post.
:
: Hello Morris,
:
: It would be possible server side, but I think by then for you it would be
: too late...what you want to do is prevent the comma's being entered at all
: (if I read your post correctly)..
:
: Try this:
:
:
http://javascript.internet.com/forms...ss-script.html
:
: It's blocking more characters than perhaps you need, I don't know - but it
: might help, and would only need a little editing...
:
: Another thing you could do would be to genereate unique id's for the boxes
: instead...
:
: I don't know what you're doing to create the form in the first place, but
: you mentioned that its an "unknown number of text boxes" which to me
: suggests that you have a loop of some sorts iterating through generating
the
: form, if this is the case, why not create a unique name on the fly, so
: instead of just "textbox_a", you stick a number on the end, ie,
: "textbox_a1", "textbox_a2"...etc, using the numbers from your iterating
: loop.
:
: The next part of course is working out how many were submitted so you can
: get the values out using your request.form once the form is
posted....couple
: of ways...
:
: 1. after the iteration, write a hidden element with the total number of
: iterations, pass this through and use it to parse the request.form the
other
: side...
:
: ie,
:
: <input type="hidden" name="iterations" value="<%=intIterations%>">
:
: Then...once submitted..
:
: intIterations = Request.Form("iterations")
:
: For intLoop = 0 To intIterations
:
: strFormElementName = "textbox_a" & intLoop
:
: Request.Form(strFormElementName)
:
: Next
:
: Alternatively, you could get the ENTIRE request.form collection, and then
do
: the reverse, ie, whilst looping through the collection, ignore any other
: fields that dont start with "textbox_a" or "textbox_b"...
:
: Either would work, I've used both in practice in the past..
Or, since your text fields are of unknown quantity, append an index to the
end of them so they each have a unique name. You can pass a hidden field
with the total number of fields and then use that as your max number of
items (-1) once posted. This eliminates the need to use client side code.
--
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