Solved

ASP

Posted on 2004-04-26
3
194 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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
pairs challenge 5 44
VB6 Compile Compatibility Issue 4 26
groovy example issue 10 65
C Programming - If Statement 8 48
This is an explanation of a simple data model to help parse a JSON feed
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.
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…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

744 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now