473,396 Members | 2,108 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Passing a value from a HTML button to another ASP page HELP!

I am creating a program that will list program times for people who
visit our website. Users can login create, edit, delete a program.
These dump into a database. The ASP webpage then reads from the
database and posts these programs for people to view (program type,
date, time, etc...). I am having trouble creating an edit option. When
bring up the edit page i want it to read the database and dynamically
create a table that has a button for each record in the recordset. I
want to be able to click that "edit" button and in a new window the
form appears filled out with the current record's information filled
in. However, to do this I am having trouble pulling out the button
name (which is the name of the DB primary key survey num) and passing
it to the other edit form. Some help me....PS i know the below code is
incorrect because it passes 28 which is the last record in the record
set, not the current. I know why it does this, I just do not know how
to fix it.
RSSQL = "Select * from Workshops where workshopdate Date()"
rs.open RSSQL,conn,1,1

if rs.recordcount = 0 then
%There are no upcoming workshops.
<%
response.end
end if

rs.movefirst

%>
<table width="499" border="1">
<tr>
<th width="139" scope="col"><div align="center">Date</th>
<th width="300" scope="col"><div align="center">Time</th>
<th width="300" scope="col"><div align="center">Location</th>
</tr>
<%

Do until rs.eof
WorkshopNum = rs("WorkshopNum")
WorkshopDate = rs ("WorkshopDate")
WorkshopStartTime = rs("WorkshopStartTime")
WorkshopEndTime = rs("WorkshopEndTime")
WorkshopLocation = rs("WorkshopLocation")

StartTime = Instr(WorkshopStartTime,":")
EndTime = Instr(WorkshopEndTime,":")
StartAMPM = right(WorkshopStartTime, 2)
EndAMPM=right(WorkshopEndTime, 2)

WorkshopStartTime=Left(WorkshopStartTime, StartTime+2)
WorkshopEndTime=Left(WorkshopEndTime, EndTime+2)

%>
<tr>
<td><div align="center"><%Response.write WorkshopDate%></td>
<td><div align="center"><%Response.write WorkshopStartTime &
StartAMPM & "-" & WorkshopEndTime& EndAMPM%></td>
<td><div align="center"><%Response.write WorkshopLocation%></td>
<td>
<input name="<%Response.Write WorkshopNum%>" type=Button onclick=
"window.open('editworkshop111.asp'); " value="Edit This Workshop"></
td>
</tr>
<%

session("workshopnum")= workshopnum

rs.movenext

loop

%>

May 10 '07 #1
6 4028
Gazing into my crystal ball I observed djjohnst <dj******@gmail.com>
writing in news:11**********************@l77g2000hsb.googlegr oups.com:
I am creating a program that will list program times for people who
visit our website. Users can login create, edit, delete a program.
These dump into a database. The ASP webpage then reads from the
database and posts these programs for people to view (program type,
date, time, etc...). I am having trouble creating an edit option. When
bring up the edit page i want it to read the database and dynamically
create a table that has a button for each record in the recordset. I
want to be able to click that "edit" button and in a new window the
form appears filled out with the current record's information filled
in.
Does it have to open in a new window? What about people who hate windows
spawning, like me? Just an observation.
However, to do this I am having trouble pulling out the button
name (which is the name of the DB primary key survey num) and passing
it to the other edit form. Some help me....PS i know the below code is
incorrect because it passes 28 which is the last record in the record
set, not the current. I know why it does this, I just do not know how
to fix it.
RSSQL = "Select * from Workshops where workshopdate Date()"
Please do not use * to select fields - name the fields individually.
rs.open RSSQL,conn,1,1

if rs.recordcount = 0 then
%There are no upcoming workshops.
<%
response.end
end if

rs.movefirst

%>
<table width="499" border="1">
<tr>
<th width="139" scope="col"><div align="center">Date</th>
<th width="300" scope="col"><div align="center">Time</th>
<th width="300" scope="col"><div align="center">Location</th>
</tr>
No need for <div align="center"on a th element. It natively does that.
Better to get rid of presentational markup and use CSS.
><%

Do until rs.eof
WorkshopNum = rs("WorkshopNum")
WorkshopDate = rs ("WorkshopDate")
WorkshopStartTime = rs("WorkshopStartTime")
WorkshopEndTime = rs("WorkshopEndTime")
WorkshopLocation = rs("WorkshopLocation")

StartTime = Instr(WorkshopStartTime,":")
EndTime = Instr(WorkshopEndTime,":")
StartAMPM = right(WorkshopStartTime, 2)
EndAMPM=right(WorkshopEndTime, 2)

WorkshopStartTime=Left(WorkshopStartTime, StartTime+2)
WorkshopEndTime=Left(WorkshopEndTime, EndTime+2)

%>
<tr>
<td><div align="center"><%Response.write WorkshopDate%></td>
<td><div align="center"><%Response.write WorkshopStartTime &
StartAMPM & "-" & WorkshopEndTime& EndAMPM%></td>
<td><div align="center"><%Response.write WorkshopLocation%></td>
<td>
<input name="<%Response.Write WorkshopNum%>" type=Button onclick=
"window.open('editworkshop111.asp'); " value="Edit This Workshop"></
td>
</tr>
Where is workshopnum here? Oh - it's not, it's down below and changes as
it loops through. That won't work. You have to put the value somewhere
in an input element. Naming the input element is not going to work
either, because you would have to test for that name coming in from the
request.

What you need is something like name="field" value="<%=workshopnum%>", or
you would put it in a querystring, eg. "window.open('editworkshop111.asp?
field=<%=workshopnum%>');" Then you can get the value from
reques.querystring.
><%

session("workshopnum")= workshopnum

rs.movenext

loop

%>

You might want to think about using getrows() as well.

--
Adrienne Boswell at Home
Arbpen Web Site Design Services
http://www.cavalcade-of-coding.info
Please respond to the group so others can share

May 10 '07 #2
Thanx for the response!!!

The thing is that it actually does pass the value of workshopnum to
the buttons! I just don't know how to pull that info out once it is
clicked. The reason i know it works is cause i'll changed

<input name="<%Response.Write WorkshopNum%>" type=Button onclick=
"window.open('editworkshop111.asp'); " value="Edit This Workshop">

to

<input name="<%Response.Write WorkshopNum%>" type=Button onclick=
"window.open('editworkshop111.asp'); " value="%Response.Write
WorkshopNum%">

and the buttons appeared 23, 24,25,26...etc.

I just want that number to go somewhere once it is clicked so I can
use that number.

Also I agree with the hating new windows poping up. I'll change that
but in the mean time I need to figure this first part out...Any other
advice!

May 10 '07 #3
djjohnst wrote on 10 mei 2007 in microsoft.public.inetserver.asp.general:
<input name="<%Response.Write WorkshopNum%>" type=Button onclick=
"window.open('editworkshop111.asp'); " value="Edit This Workshop">
<input
type=Button
onclick="window.open('editw.asp?wNum=<%=WorkshopNu m%>')"
value="Edit This Workshop">

and in the "editw.asp" file:

<% 'vbs
WorkshopNum = request.querystring("wNum")
%>

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
May 10 '07 #4
YES! that worked!! I want to give you a big kiss!!! Thank you so much!

May 10 '07 #5
djjohnst wrote on 10 mei 2007 in microsoft.public.inetserver.asp.general:
YES! that worked!! I want to give you a big kiss!!! Thank you so much!
Even so, it would be better if you quote what you are replying on,
since we then would know what you are talking about.

After all, this is usenet.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
May 11 '07 #6
haha forgive me...

what worked was as follows:

<input name="<%Response.Write WorkshopNum%>" type=Button onclick=
"window.open('editWorkshop111.asp?wNum=<%=Workshop Num%>')" value="Edit
This Workshop"></td>

May 14 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Davide Bruzzone | last post by:
Greetings all... Here's a description of the problem that I'm trying to solve: - I have a Web page from which users can open one or more other windows. - From that web page, the user can then...
12
by: Kevin Lyons | last post by:
Hello, I am trying to get my select options (courses) passed correctly from the following URL: http://www.dslextreme.com/users/kevinlyons/selectBoxes.html I am having difficulty getting the...
1
by: Kevin Lyons | last post by:
Hello, I am trying to get all of my form elements passed correctly from the following URL: http://www.dslextreme.com/users/kevinlyons/selectBoxes.html to the following URL:...
2
by: Richard | last post by:
**** Post for FREE via your newsreader at post.usenet.com **** HI, I am working on a project where I need to input data to a (local) HTML page using multiple form elements, such as text,...
6
by: Eric Johnston | last post by:
I want the visitor to enter three numbers on the page and then click a button "generate image" which will I hope cause a generated gif image to be displayed alongside on the page. This involved...
5
by: Jim via DotNetMonster.com | last post by:
Hi, I need to pass the value of a variable from one function to another but I don't seem to get the value. I declare the variable outside all functions. What I'm trying to do is that when the...
5
by: Steve | last post by:
Hi, I currently have a problem passing a variable value from one page to another. Once a form submit button is pressed java pops up a window and displays some information. The problem being is...
1
by: johnjsforum | last post by:
Buddies, I have a web page to create HTML buttons dynamically as in the “formDivColorPicker” function ////////////////////////////////////////////////////////////////////////////////////...
5
by: TurboRogue | last post by:
So here's the basic premise: I have an html page with a bunch of pictures (pic.html). All of the images are thumbnails of larger photos. I also have another html page which is a pop-up window...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.