473,405 Members | 2,444 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,405 software developers and data experts.

passing value from one form to another-urgent.

hi ...

I have an asp page which has 3 buttons.
<p align="center"><input class="button" type="button"
onClick="location='welStudent.asp';" value="Click to write a new story"></p>
<p align="center"><input class="button" type="button"
onClick="location='draftedStory.asp';" value="Click to complete the drafted
story"></p>
<p align="center"> <input class="button" type="submit" value="Click to view
your grade sheet" name="submit"> </p>

when i have written <form method="post" action="viewEditedStory.asp"
name="teacher"> then the values of the radio button declared in form goes
only in asp "viewEditedStory.asp". I want to use the radio button value also
on clicking 2nd button described above (i.e. in 'draftedStory.asp') how can
i do this?

here is my code:

<%
DIM RSA
DIM RSA2
DIM QUERY
DIM RSA3
DIM RSA4
DIM RSA5
DIM QUERY5
dim icount
DIM icount2
DIM flgNewStudent
Dim flgStudStoryCorrected

icount=0
flgNewStudent="FALSE"
flgStudStoryCorrected = "FALSE"

set RSA4 = Server.CreateObject("ADODB.Recordset")
RSA4.OPEN "Select story_id,status_student,story_status_date from
student_content where student_id="&session("loggedID")&"", "dsn=school"

'if a student logs in for the first time
if RSA4.EOF then
FLAGNEW="TRUE"
response.write "<font color=#800080 size=6>" & session("logged_name") & "
you are coming for the first time and hence you have no stories written till
now"
%>
<html>
<head> <link rel="stylesheet" href="style.css" type="text/css" /> </head>
<body BGCOLOR="pink">
<p align=center><input class="button" type="button"
onClick="location='welStudent.asp'"; value="Click to write a new story"
style="width:230"> </p>
<%
response.end
end if
%>
<html>
<head>
<link rel="stylesheet" href="style.css" type="text/css" />
</head>
<body BGCOLOR="pink">
<center><font color="#800080" size="6"><b>"<%=session("logged_name")%>" you
have written following stories </b></font></center>
<p><center></p>
<form method="post" action="viewEditedStory.asp" name="teacher">
<table border>
<thead valign="top" >
<tr>
<th>Student ID</th>
<th>Student Name</th>
<th>Story ID</th>
<th>Story Name</th>
<th>Student Story Status</th>
<th>Story Submitted Date</th>
<th>Teacher Story Status</th>
<th>Teacher Story Comment</th>
<th>Teacher Story Grade</th>
<th>Story Corrected Date</th>
</tr>
</thead>

<%
'if the student has written at least one story
do while not RSA4.EOF

FLAGNEW="FALSE"
response.write "student has at least written a story"
session("story_id") = RSA4.Fields ("story_id")

'retrieving story name
set RSA5 = Server.createObject("Adodb.recordset")
QUERY5="Select story_name from story_table where
story_id="&session("story_id")&""
RSA5.OPEN QUERY5, "DSN=SCHOOL"

'retreiving whether teacher has corrected any of the stories written by
student
set RSA = Server.CreateObject("ADODB.Recordset")
QUERY = "SELECT status_teacher,story_edited_date,story_comment,sto ry_grade
FROM teacher_content where student_id ="&session("loggedID")&" and story_id=
"&session("story_id")&""
RSA.OPEN QUERY, "DSN=school"

if RSA.EOF then
'do nothing but set a variable
flgStudStoryCorrected = "no"
response.write "there are no matching record in teacher table"
else
flgStudStoryCorrected = "yes"
response.write "there is a mactching record in teacher table"
end if
%>
<tr>
<td><input type=radio name=RR
value=<%=session("story_id")%>;<%=session("loggedI D")%>></input> <%=
session("loggedID") %></td>
<td> <%= session("logged_name") %></td>
<td> <%= RSA4.Fields ("story_id").Value %></td>
<td> <%= RSA5.Fields ("story_name").Value %></td>
<td> <%= RSA4.Fields ("status_student").Value%></td>
<td> <%= RSA4.Fields ("story_status_date").Value%></td>
<%
'assigning status student to a session variable
'session("statusStudent") = RSA4.Fields ("status_student").Value
'response.write session("statusStudent")
'if teacher has corrected the story then come here
if flgStudStoryCorrected="yes" then
%>
<Td> <%= RSA.fields("status_teacher").value%></td>
<Td> <%= RSA.fields("story_comment").value%></td>
<Td> <%= RSA.fields("story_grade").value%></td>
<Td> <%= RSA.fields("story_edited_date").value%></td>
<%
end if
%>
</tr>
<%
iCount2 = iCount2 + 1
rsa4.movenext
loop
%>

<p align="center"><input class="button" type="button"
onClick="location='welStudent.asp';" value="Click to write a new story"></p>
<p align="center"><input class="button" type="button"
onClick="location='draftedStory.asp';" value="Click to complete the drafted
story"></p>
<p align="center"> <input class="button" type="submit" value="Click to view
your grade sheet" name="submit"> </p>
</table>
</form>
</body>
</html>

Jul 19 '05 #1
1 5736
Drop the javascript location.href stuff since that's not going to submit the
form, make your three buttons submit buttons and run your code on the submit
page according to which button was used to submit.

<input class="button" type="submit" value="Click to write a new story"
name="submit">
<input class="button" type="submit" value="Click to complete the drafted
story" name="submit">
<input class="button" type="submit" value="Click to view your grade sheet"
name="submit">
<%

sSubmit = Request.Form("submit")
Select Case True
Case Instr(sSubmit, "new") > 0
'''code for new story
Case Instr(sSubmit, "drafted") > 0
'''code for drafted story
Case Instr(sSubmit, "grade") > 0
'''code for viewing grade sheet

Case Else
'''What if user presses Ctrl+M to submit? No button was clicked.
Put appropriate code here.
End Select
%>
The client-side solution would be something like:
<input class="button" type="submit" value="Click to write a new story"
name="submit" onclick="this.form.action='welStudent.asp';">
<input class="button" type="submit" value="Click to complete the drafted
story" name="submit" onclick="this.form.action='draftedStory.asp';">
<input class="button" type="submit" value="Click to view your grade sheet"
name="submit" onclick="this.form.action=viewEditedStory.asp';">
Ray at work

"monika" <mo********@hotmail.com> wrote in message
news:OE*************@TK2MSFTNGP09.phx.gbl...
hi ...

I have an asp page which has 3 buttons.
<p align="center"><input class="button" type="button"
onClick="location='welStudent.asp';" value="Click to write a new story"></p> <p align="center"><input class="button" type="button"
onClick="location='draftedStory.asp';" value="Click to complete the drafted story"></p>
<p align="center"> <input class="button" type="submit" value="Click to view your grade sheet" name="submit"> </p>

when i have written <form method="post" action="viewEditedStory.asp"
name="teacher"> then the values of the radio button declared in form goes
only in asp "viewEditedStory.asp". I want to use the radio button value also on clicking 2nd button described above (i.e. in 'draftedStory.asp') how can i do this?

Jul 19 '05 #2

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

Similar topics

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,...
3
by: domeceo | last post by:
can anyone tell me why I cannot pass values in a setTimeout function whenever I use this function it says "menu is undefined" after th alert. function imgOff(menu, num) { if (document.images) {...
1
by: Al Jans | last post by:
Hi, I'm having a problem passing a value from a field on one form to another field on another form. The value is being passed between forms, however it's not being displayed and i've got no idea...
8
by: Johnny | last post by:
I'm a rookie at C# and OO so please don't laugh! I have a form (fclsTaxCalculator) that contains a text box (tboxZipCode) containing a zip code. The user can enter a zip code in the text box and...
3
by: michael | last post by:
let me keep it clean, quick and simple. I am passing a variable into another window and am reassigning the value on the new page - window.document...value = opener.document. ....value and...
13
by: Deano | last post by:
Apparently you can only do this with one value i.e Call MyAssetLocationZoom(Me!txtLocation, "Amend data") This runs; Public Sub MyAssetLocationZoom(ctl As Control, formName As String) On...
7
by: AMP | last post by:
Hello, I have this in form1: namespace Pass { public partial class Form1 : Form { public Form2 form2; public Form1() {
9
by: itarizin | last post by:
Today I found as ignorance owe me.. Let me explain what I'm tring to do and fail (fail: in my needs) For example, I've my stupid class: public class Hello { private int x = 0; public...
4
idsanjeev
by: idsanjeev | last post by:
SIR I AM PASSING VALUE FROM ONE FORM TO ANOTHER FORM THROUGH COOKIES BUT IS CAN ONLY TRANSFER LAST VALUE HOW CAN PASS VALUE AFTER CLICKIN ON LINK I AM USING THE CODE IS FOR LINK <td><a...
4
by: John Sheppard | last post by:
Hello there I was wondering if anyone could help me, I am trying to pass a typed dataset to a dialoged child form by reference. I have binding sources sitting on the child form. So to refresh...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.