Solved

ASP

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

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!

Question has a verified solution.

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

Suggested Solutions

This article will show, step by step, how to integrate R code into a R Sweave document
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
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 …

734 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