?
Solved

ASP

Posted on 2004-04-26
3
Medium Priority
?
203 Views
Last Modified: 2010-04-17
I have 10 buttons and textboxes. I need to get the value of each textbox and store it into an array using asp.
Is this possible. Thank you.
0
Comment
Question by:Shelmina_Shivji
[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
  • 2
3 Comments
 
LVL 3

Accepted Solution

by:
Sleepyhead_NO earned 200 total points
ID: 10920590
in form.asp:

<form name="form_info" action="script.asp" method="post">
<input type="text" name="name">
<input type="text" name="age">
etc.
<input type="submit">
</form>

in script.asp:
<%
dim MyArr(10)
MyArr(0) = request.form("name")
MyArr(1) = request.form("age")
' etc
%>

if you name your form fields with a number like this: name="text1" text2 etc. then you can use

for i = 0 to 9
    MyArr(i) = request.form("text" & i)
next
0
 

Author Comment

by:Shelmina_Shivji
ID: 10964400
Thanks for responding. But the problem is, when I submit the textbox value disappears as I am also calling a javascript function to disable the textbox. The first function "foo" enables the textbox. And the second one "foo1" disables the texbox.
The code is below. Thanks for your help.
Note: I am just trying with one textbox now.

dim i
response.write "<form name='myform' method='post'>"
response.write "<table border='1'>"
response.write "<tr><td><input type='textbox' name='try'  disabled='disabled'></td>"
response.write "<td><input type='button' value='Modify' onclick = 'foo(try)'></td>"
response.write "<td><input type='submit' value='submit' onclick = 'foo1(try)' name='submit'></td></tr>"

dim x
x = request.form("try")
 response.write x
0
 
LVL 3

Expert Comment

by:Sleepyhead_NO
ID: 10967161
if a textbot is disabled, it will not pass the value. use the readonly attribute instead. both of these attributes cannot have values, so writing disabled="disabled" is not correct - use <input disabled>.

with javascript it should be:
document.myform.try.readonly = true;

to make the checkbox looked disabled you can use CSS to modify the background or text color so it appears to be disabled. alternatively you can use the disabled attribute and with javascript get the value and put it in a hidden form element.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
Introduction to Processes
Starting up a Project
Suggested Courses
Course of the Month8 days, 6 hours left to enroll

766 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