Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Create Dynamic Input Names or Input Fields in Asp

Reply
Thread Tools

Create Dynamic Input Names or Input Fields in Asp

 
 
gotcha
Guest
Posts: n/a
 
      10-24-2003
I have a little code to add multiple items to a shopping cart based
page. This code works perfect, but it adds all of the info to the
same input fields every time it loops. I need it to change the input
names each time it loops. Here is the code.


<% FOR x = 0 TO UBOUND( localCart, 2 )
IF localCart( CARTPID, x ) <> "" THEN
orderTotal = orderTotal + ( localCart( CARTPPRICE, x ) * localCart
( CARTPQUANTITY, x ) )

DIM chId,chProduct,chPrice,chQuantity
chId=(localCart( CARTPID, x) )
chProduct=Server.HTMLEncode( localCart( CARTPNAME, x ) )
chPrice=formatCurrency( localCart( CARTPPRICE, x ) )
chQuantity=localCart( CARTPQUANTITY, x )%>

<input name="Partnumber1" type="text" value="<%="" & chId & vbcrlf &
"" %>" size="40">
<input name="Partnumber2" type="text" value="<%="" & chProduct & ""
%>" size="40">
<input name="Partnumber3" type="text" value="<%="" & chPrice & "" %>"
size="40">
<input name="Partnumber4" type="text" value="<%="" & chQuantity & ""
%>" size="40">

<%
END IF
Next
%>

This is what I am getting with two items in the cart. Duplicate
PARTNUMBERS.

<input name="Partnumber1" type="text" value="07908-00036 " size="40">
<input name="Partnumber2" type="text" value="Right Mounting Bracket -
for Mounting Tape Drive to Chassis" size="40">
<input name="Partnumber3" type="text" value="$11.00" size="40">
<input name="Partnumber4" type="text" value="3" size="40">


<input name="Partnumber1" type="text" value="27303-69001 " size="40">
<input name="Partnumber2" type="text" value="ThinLAN (10Base-2) Board
- for NOVELL NetWare" size="40">
<input name="Partnumber3" type="text" value="$216.00" size="40">
<input name="Partnumber4" type="text" value="3" size="40">


I need to get different PARTNUMBERS such as this.

<input name="Partnumber1" type="text" value="07908-00036 " size="40">
<input name="Partnumber2" type="text" value="Right Mounting Bracket -
for Mounting Tape Drive to Chassis" size="40">
<input name="Partnumber3" type="text" value="$11.00" size="40">
<input name="Partnumber4" type="text" value="3" size="40">


<input name="Partnumber5" type="text" value="27303-69001 " size="40">
<input name="Partnumber5" type="text" value="ThinLAN (10Base-2) Board
- for NOVELL NetWare" size="40">
<input name="Partnumber7" type="text" value="$216.00" size="40">
<input name="Partnumber8" type="text" value="3" size="40">

Thanks for any help in advance.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
epydoc: How to add new fields as the building fields? Cyril.Liu Python 0 12-02-2008 05:01 AM
print struct fields and its member structs' fields recursively, generically call_me_anything C++ 4 09-30-2007 10:12 PM
how to copy from fields to other fields middletree ASP General 1 11-05-2003 06:24 PM
input names with '-' in their names. Sandman Javascript 4 09-04-2003 08:11 AM
Netscape hidden fields - array - multiple fields with same name mark.reichman@rl.af.mil Javascript 0 07-17-2003 03:05 PM



Advertisments