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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Response.Write Fields ONLY "IF"

Status
Not open for further replies.

JrClown

Technical User
Oct 18, 2000
393
US
hello fellas, I was wondering is this can be done, and how?

I have an ASP form:
Client: ------ > all text field
Description: ------ > all text field
Sales Rep: ------ > all text field
Items Number: ------ > all text field
********************************
What I would like to know is the following:
When the user types in the Items Number: field say, 1 or 2 or 50 or 200
I would like the same form to write text fields equal to the number typed in the Items Number: field so users can fill them out.

Any Ideas would be appreciated??

QUOTE OF THE DAY
Not to know if bad; not to wish to know is worse.
<%
Jr Clown
%>
 
Are you sure about 200.
Code:
<%
Dim I

For I = 1 to Limit
    Response.write &quot;textbox stuff using same name for each textbox&quot;
Next
Using same NAME= means using an array index when fetching from Request.Form(&quot;Textbox&quot;)(I) or something like that.
I'm rusty but when ASP finds the same name it creates an array.
 
man, I just read about FOR LOOP, I may have to do that. thanks for your suggestion tho QUOTE OF THE DAY
Not to know if bad; not to wish to know is worse.
<%
Jr Clown
%>
 
Hey Jr Clown,

I know the title of this post is Response.Write..., so JohnYingling's answer is right on to what you're talking about, but consider this option. If your client is using IE (5 or higher or maybe just 4 or higher), and you wanted to be able to do this from the original form where the user specifies the number of items without posting first, you could put in some client-side VBScript like this:

Code:
Dim sElementTag
Dim objElement
Dim iInt

For iInt = 1 to window.frmMyForm.txtItemsNumber.value
    sElementTag = &quot;<INPUT type='text'&quot;
    sElementTag = sElementTag & &quot; onBlur='ValidateItem(me)'&quot;
    sElementTag = sElementTag & &quot;>&quot;
    Set objElement = document.createElement(sElementTag)
    objElement.ID = &quot;txt&quot; & &quot;Item&quot; & iInt
    objElement.className = &quot;InputBox2&quot;
    objElement.value = &quot;&quot;
    objElement.style.width = &quot;50px&quot;
    document (or other container, like a table or div).insertAdjacentElement &quot;BeforeEnd&quot;, objElement
    Set objElement = Nothing
Next
 
Thank you GlennBSI, I'm looking into it as we speak. QUOTE OF THE DAY
Not to know if bad; not to wish to know is worse.
<%
Jr Clown
%>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top