Solved

ASP

Posted on 2004-04-26
3
199 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

Industry Leaders: 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!

Question has a verified solution.

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

Suggested Solutions

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 …
Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

679 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