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
Solved

ASP

Posted on 2004-04-26
3
198 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
  • 2
3 Comments
 
LVL 3

Accepted Solution

by:
Sleepyhead_NO earned 50 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
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…

839 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