?
Solved

Populate data into form

Posted on 2003-02-21
9
Medium Priority
?
129 Views
Last Modified: 2010-05-03
I am trying to populate data of an array into text boxes. I have the following code:

for i = 0 to UBound(array,2)
response.write "<input type=""text"" name=""EmployeeName"" value="&array(0,i)&"><br>"
next

However, the resulting text boxes only show the first name of the employee, ignoring the rest, i.e. the last name and the space in between. Any suggestions?
0
Comment
Question by:shang_lan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 43

Expert Comment

by:TimCottee
ID: 7993624
You need to also encapsulate that into quotes:

for i = 0 to UBound(array,2)
response.write "<input type=""text"" name=""EmployeeName"" value="""&array(0,i)&"""><br>"
next
0
 
LVL 43

Expert Comment

by:TimCottee
ID: 7993634
Or perhaps to avoid confusion with the number of " characters use ' instead:

for i = 0 to UBound(array,2)
response.write "<input type='text' name='EmployeeName' value='"&array(0,i)&"'><br>"
next
0
 
LVL 1

Expert Comment

by:jeffreyhamby
ID: 7993696
Here's what I got working in VB with a Textbox called Text1 and a command button called Command1 (the defaults).
You've got to use the Chr(34) in place of the " characters, because VB interprets those as the end of the sting instead.

Private Sub Command1_Click()
Dim strArray(0 To 4, 1 To 2) As String
Dim i As Integer

strArray(0, 1) = "Mantle"
strArray(0, 2) = "Mickey"
strArray(1, 1) = "Mouse"
strArray(1, 2) = "Mickey"
strArray(2, 1) = "Mouse"
strArray(2, 2) = "Mighty"
strArray(3, 1) = "Casey"
strArray(3, 2) = "Mickey"
strArray(4, 1) = "Mouse"
strArray(4, 2) = "Sean"


For i = 0 To UBound(strArray)
    With Text1
        .Text = .Text & "<input type=" & Chr(34) & Chr(34) & _
            "text" & Chr(34) & Chr(34) & " name=" & Chr(34) & Chr(34) & _
            "EmployeeName" & Chr(34) & Chr(34) & _
            " value=" & strArray(i, 1) & "><br>"
        .Text = .Text & "<input type=" & Chr(34) & Chr(34) & _
            "text" & Chr(34) & Chr(34) & " name=" & Chr(34) & Chr(34) & _
            "EmployeeName" & Chr(34) & Chr(34) & _
            " value=" & strArray(i, 2) & "><br>" & vbCrLf
    End With
Next

End Sub
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:shang_lan
ID: 7998458
I still cannot get it to work...I've seen articles about server.htmlencode stuff...has it got anything to do with it?
0
 
LVL 1

Expert Comment

by:xThorx
ID: 8025157
First make sure multiline is set to true in your text1 property.

text1.text=""
for i = 0 to UBound(array,2)

 text1.text=text1.text
 "<input type=""text"" name=""EmployeeName"" value="&array(0,i)&"><br>"
next
0
 
LVL 1

Expert Comment

by:xThorx
ID: 8025174
Arf

text1.text=""

for i = 0 to UBound(array,2)-1
 if i>0 then text1.text=text1.text & vbcrlf
 text1.text=text1.text & "<input type=""text""name=""EmployeeName"" value= " & array(0,i)
next

now i'm done!
0
 

Expert Comment

by:CleanupPing
ID: 8901316
shang_lan:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
Experts: Post your closing recommendations!  Who deserves points here?
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 8964060
shang_lan, an EE Moderator will handle this for you.
Moderator, my recommended disposition is:

    Save as PAQ -- No Refund.

DanRollins -- EE database cleanup volunteer
0
 

Accepted Solution

by:
YensidMod earned 0 total points
ID: 9103985
Question is PAQ'd and no points refunded.

YensidMod
Community Support Moderator @Experts Exchange
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses
Course of the Month13 days, 16 hours left to enroll

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question