Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > passing value from one form to another-urgent.

Reply
Thread Tools

passing value from one form to another-urgent.

 
 
monika
Guest
Posts: n/a
 
      09-18-2003
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>



 
Reply With Quote
 
 
 
 
Ray at
Guest
Posts: n/a
 
      09-18-2003
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" <> wrote in message
news:...
> 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?
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to retrieve form field value if form is EncType=multipart/form-dataForm? Li Zhang ASP .Net 4 02-27-2009 01:23 AM
passing values from one web form to another web form bbawa1@yahoo.com ASP .Net 5 06-12-2007 05:50 AM
Loop Form - extract display 'value' as well as form value? ASP General 2 02-20-2006 09:36 PM
Passing value from one form to another Mike ASP .Net 4 07-14-2004 03:47 AM
Passing value from one script on one page to another script on another page. Robert Cohen ASP General 3 07-15-2003 01:46 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57