?
Solved

Requesting value form a dynamic text box

Posted on 2003-03-20
4
Medium Priority
?
1,678 Views
Last Modified: 2008-02-02
Hello people,

Can anybody assist on how I can request the values thats is inputed into a dynamic textbox (That is, a text box that is repeating itself based on the number of rows returned in a recordset)

I hope to hear from you all very soon.

Thank you.
0
Comment
Question by:babsjid
[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
4 Comments
 
LVL 33

Expert Comment

by:hongjun
ID: 8173242
>>how I can request the values
Client side? How do you name the dynamic textboxes? If it is something like thi

<form name="frmMain">
<%
do while not rs.eof
%>
    <input type="text" name="mytext"...>
<%
loop
%>
</form>


Since you are having more than 1 textboxes having the same name "mytext", you can actually use the below to get the values.


<script language="JavaScript">
alert(document.frmMain.mytext[0].value);  // get first textbox
alert(document.frmMain.mytext[1].value);  // get second textbox
</script>


hongjun
0
 
LVL 4

Expert Comment

by:Sashi Rachabattula
ID: 8173248
pls send yhe code of ur Creation od dynamic text box
0
 

Accepted Solution

by:
mella earned 200 total points
ID: 8180180
Dear babsjid,

if I understand you right, you have problems with requesting what was put into an unknown number of text fields.

You might want to create your dynamic textfields with the same name for all of them, e. g. "mytextfield". Then, when you request your form inputs on the form processing asp page, when you request "mytextfield" you will get the values of all your dynamic textfields as one string, separated by commas. You split them up into an array, and loop through the array in order to access each of them separately. See the code below. Hope to have helped.

-------------------------------
Code for myform.asp

<%
sql="select myfield1, myfield2, myfield3 from mytable"
rs.open sql, objconn
%>


<form name="myform" method="Post" action="form_processing.asp" >

<%do while not rs.eof
%>

 <input type="text" name="mytexfield">

<%
rs.movenext
loop
%>

</form>
<%rs.close%>

-------------------------------
Code for form_processing.asp

<%
'request the textfield from the previous page
'what you will get is the values of your dynamic textfields all in one string, separated by commas

mytextfield=Request.form("mytextfield")

'to separate the values, split them up into a string

myarray=split(mytextfield, ",")

'now you have an array which contains the values of your dynamic textfields. To access them separately, and add them, for example, to a database, you can loop through the array

for i=0 to ubound(myarray)
 sql="Select myfield from mytable"
 rs.open sql, objconn, 3,3
 rs.addnew
 if trim(myarray(i))<>"" then
   RS("myfield")=myarray(i)
 end if
 rs.update
 rs.close
next
%>
0
 
LVL 58

Expert Comment

by:Gary
ID: 9313515
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Accept Answer by mella

Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
GaryC123
EE Cleanup Volunteer
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

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

770 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