Loop Through List Box Values In ASP
I have an ASP page that has 2 List Boxes. The first List Box contains available items and the 2nd list box contains selected items. Code:
<select name="lstAvailable">
<option value=”1”>User 1</option>
<option value=”2”>User 2</option>
<option value=”3”>User 3</option>
</select>
<select name=”lstSelected”>
</select>
I have JavaScript that populates the lstSelected when items are clicked on from the lstAvailable list box.
When the user presses the Submit button, a 2nd ASP page actually does the insert. My problem is that I do not know how to retrieve the value from the 2nd list box (lstSelected) from the 2nd ASP page. I need to do an insert for each item in the selected list box.
I have tried using Request.Form(“lstSelected”) but that did not work. I also tried a For next loop but I could not get that to work either.
Can someone help me figure out how to loop through all values in the lstSelected list box from the 2nd ASP page?
View Replies
ADVERTISEMENT
I have a list in a form where allows multiple selections
<select name="writerID" size="4" multiple >
<option value="no" selected> ---- writer ---- </option>
<%
do until RS.eof %>
<option> <%=RS(0)%> </option>
<%
RS.movenext
loop
%>
</select>
How do I make the loop in the add section where I have to retreive the records and add the selections?:
For ??????
RS.AddNew
RS("writerID") = request.form("writerID")
RS.Update
next
View Replies
View Related
I am reading about 200 records from dbf file in ASP code and inserting into a table. I fetch the records in a recordset and in the recordset loop I have to insert it into the SQL table.
How should I insert the values?
1) Should I use query in ASP page
2) Or call stored procedure (passing each record parameter) for inserting, 200 times in the loop
View Replies
View Related
I have an ASP page connected to an Access database table. Im wondering of an easy do while loop which will go through each of the records in a specific column and add them up.
Do While Not objRS.EOF
objRS.MoveNext
'Code to add the sum to TotalNumberValue using objRS("NumberValue") recordset
Loop
View Replies
View Related
I don't know if this is possible, but I have a Do While Not rs.EOF loop that is pulling values from a SQL database and writes it to an html form. I'm trying to figure out how to tally the values as they are siphoned from the database -- I'm assuming I have to set a unique variable equal to that value as it goes through the loop, but I'm not certain how to pull it off. Code:
View Replies
View Related
I am using a ASP.NET function that returns a table with columns and rows and data (in the cells) taken from my DB (using ado.NET). That function actually returns a set of HTML tags with values, Labels and input boxes. All of that is working fine but now (after the function build that form whith that table) I want the user to fill some of the input boxes located in the last column.
The problem is that i do not know how many input text boxes had been changed by the user (different rows) and i need to manage all the input data of those input boxes.
in VB.NET I can use a loop which goes for each and rvery control and take its text (or value) property.
How can I do that here ?
How can i chack each of the input boxes values using a loop (becuse that input boxes had been filled accourding to a database and in additional the user changed/Add values to some of them ?
for information, to fill the that table i am using a loop that filled the table rows and values accourding to the rows in the DataBase and names of those inputboxes called: "Amount_" & i the "i" is an index which represent the row in the database.
View Replies
View Related
How at the start of script can I dynamically loop through all Request.form variables and use them ? either name or the value, both is the ideal though.
example.
have a form:
2 textfields. named "text1" and "text2"
In asp I need to dynamically grab this data not knowing that this form had the textfields "text1" and "text2".
ideal print:
name "text1"
value of text 1
name "text2"
value of text2
View Replies
View Related
I am trying to pass a value into the text field on selecting the option in a drop down. The code works if the 'For' loop is not included. What should I do to make it work inside the loop? Code:
View Replies
View Related
I am using list box on one page which has 5-6 values now i want that user should able to select only one value at a time from list box ,now after selecting value when he click submit button it should direct it another asp page which also has a list box and that list box should have all values which was on previous list box on first page , i m using post method.
user only able to select single value from list box on first page but second page should display all vaues in list box.
View Replies
View Related
I have multiple list box added to the asp page using <select> tag. I have added items in the list box using recrdset from Education table Education table={educationid, educationname}
User can choose more than items from the list box. These items gets added in the user table in field "edu" seprated by commas. When User wants to edit his information ...i want that the items in the list box should be automatically selected which are present in "edu" field.
View Replies
View Related
I have a list box with five values in it. These are essentially account groups. The user will select one of these values and click on a button. This will update a second list with specific account names depending on what the user selected on the first list.
These account names will be retrieved from an SQL database. Below is the code which sets up the first list and the button. Code:
View Replies
View Related
I know how to write cookies and how to call cookies. But how do I write the values of a drop down list and the value of a radio button list to a cookie and call them to select the correct options when the page is reloaded?
View Replies
View Related
I have a textarea that displays the values from the recordset. But how can I display each value in a seperate line
While not rsHires.EOF
Response.Write rsHires("Emp_Name") & "
"
rsHires.MoveNext
wend
I tried <br> too, but they get printed into the textarea.
View Replies
View Related
I am trying to learn and use good DHTML concepts and code (assuming they are needed). My current issue concerns how to handle this situation.
I have a Select List box which displays values based on what value is selected in a dropdown list. For example, my dropdown list contains a class name, and the Select list contains all of the students who are registered for that class.
So what I would like to occur, is when the user changes the class from the dropdown box, the Select List is re-created displaying the students who are enrolled in that class.
I thought I could do this without having to reload the page (with DHTML) but here is my problem. Code:
View Replies
View Related
I'm trying to pass a parameter from a for loop to the nested while loop
but only the first counter is passed. Here is the code:
View Replies
View Related
I have a recordset that I loop through all of the data within a table, within the same loop, I am trying to add another loops that pulls information from the first recordset to base the second recordset off of: Code:
View Replies
View Related
How can i list out all the email address into my website from the hotmail caontact list? i am successful log in into the yahoo contact list by using serverxmlhttp and list out all the email address from the page source, but i could not access to hotmail by using the serverxmlhttp. Is any other methos can list out the email address from hotmail contact list?
View Replies
View Related
I want to call a recordset so you can edit the details and then obviously pass the parameters onwards into the db. However, the user guide just says this:
To process other fields in the form, use the Form collection of the upload object the same way you would use the Form collection of the Request object. For example, if your form had a text element named UserName, your processing code would include: Code:
View Replies
View Related
i need to convert the escape values which are by mistake updated in DB.
example:
this is a sample text string
is updated in DB as
this%20is%20a%20sample%20text%20string
here %20 is the space.
like wise there are many entries for :,'
is there way that i can update all this in a update statement?
or use asp to to update the records?
View Replies
View Related
I have a variable SET which has the value Of 1, 2, 3, .., N.
SET=val1, val2, val3, val4, ..., valN
What is the commend or procedure to extract individual values, val1, val2, ...
View Replies
View Related
I have a case statment like
select case code
case "01"
ups_desc = "OPTION1."
case "02"
ups_desc = "OPTION2."
case "03"
ups_desc = "OPTION3"
case "07"
ups_desc = "OPTION4"
case "08"
ups_desc = "OPTION5 "
case "11"
ups_desc = "OPTION6"
case "12"
ups_desc = "OPTION7"
end select
I then have table called "users" which has the following
id
UserID
Code
now the trick
I want to loop through the recordset of the user tables and populate a drop down where the code from the case and the user table are the same.
Something like
do while rs("code") = code
<option> This then is populated based upon the loop(I have this code)</option>
loop
View Replies
View Related
I need to insert recordes into a db based upon a number returned in a form
Somerthing like
AddRecords = Request.Form("NumberOfRecords")
Count = 0
if Count < AddRecords Then
Do while Count.eof
SQL Code....
Count = Count + 1
Count.move next
Loop
End If
View Replies
View Related
i have 2 tables (A & B) with date records
now i loop table A and then table B, the output will be table A in the front
and table B in the back.how can i make the output show by date in both tables altogether?
do i need to combine tables before but the number of records is over 100K
which may spend a lot of processing power?
View Replies
View Related
on my classifieds site i would like to create a simple ads system. i currently have the ads site made but need some advice.
on my classifieds site i would like to display the ads down the left hand side.
however i dont want to over display ads.
if there is not many items listed i only want a small amount of adverts shown on the left hand side. however if there is lots listed
i would like quite a few adverts listed.
otherwise i would have a big list of adverts and only a small number of items listed making a big blank space on my page.
i am guessing this would have to be a loop or something.
the code i am using to show the text links is <%=adurl%>
View Replies
View Related
I am using a for loop in one of my asp page. Could someone let me know if I can do the for loop as follow:
[code]<% for i = 1 to 5 %>
my html code
my html code
my html code
<% Next i %>
instead of
[code]<%
for i = 1 to 5
Response.Write "<input name = 'id'"&i&" type='text' value = "&id& ">"
Next i
%>
View Replies
View Related
I am using ASP and need a DO LOOP to get some info back from the db. but the asp reads the first do loop but does not read the second one ......
View Replies
View Related
is there any function or statements that work the same as the 'break' statement in C++ language?
for example:
While Not rs.EOF
If rs("LoginID") = userId Then
break 'what shd i use for ASP???
Else
rs.movenext
View Replies
View Related
im writing some script to add records to my db. but if a value thats about to be added exists, then dont add that record.for example: if i want to add 7 records to my db with the values 1 - 7, but the db already has 3, 5 and 7, then it should only add 4 new records (1, 2, 4 and 6).
i have a record returning all records form my db, and an array with the values i want to add. i want to loop through my recordset of all existing entries, then for each loop, start another loop to see if the value exists, and if it doesnt , then add a new record.
View Replies
View Related
How to use the for loop or do while loop to create the age range from 10 -100 to let the user to select from the form object - list/menu by using asp? The coding below is just a concept. For example
Response.Write("<select name=""select"">")
for (a=0; a<101; a++)
(
Response.Write("<option value=""" & age & """>" & age & "</option>")
)
Response.Write("</select>")
View Replies
View Related
I'm trying to create a page where images are displayed based on an id in a sql table (basically its an unlit candle until a value in the id field exists). I'm not getting an error with my code below - but its not working right either. Code:
<% If rs("my_id")="2" Then Response.Write "<img src=""images/07.jpg"" width=""56"" height=""97"" alt="lit candle">"Else Response.Write "<img src=""images/UNLIT_07.jpg"" width=""56"" height=""97"" alt=""unlit candle"">" End If %> ...
View Replies
View Related
I have a SUB which has input variables. If I run it once its okay, but I need to include it in a for....next loop. Can this be done ?
for i=0 to 100
call mySub(arr(0,i))
next
sub mySub(var)
.....code
end sub
View Replies
View Related
I am getting this error:
Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC Microsoft Access Driver]Numeric value out of range
(null)
/database/data_entry.asp, line 90
Line 90 is shown below...
// count the total records by iterating through the recordset
for (rsProducts_total=0; !rsProducts.EOF; rsProducts.MoveNext())
{ <---- Line 90
rsProducts_total++;
}
This is an access database, connected to via a DSN. Any help will be muchly appreciated! I'm stuck on this one.
View Replies
View Related
I'm using three loops on a page and would like to set the loops individually to start at either 0 or -1 based on a condition. As an example, I would want the loop to start at either -1 as shown or 0.
Dim r
For r = --1 to Session("TotalRowsF")
code...
Next
Or, based on the condition it could be
Dim r
For r = 0 to Session("TotalRowsF")
code...
Next
View Replies
View Related