ASP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreASP Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old September 18th, 2003, 12:26 PM
aspuser25 aspuser25 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 141 aspuser25 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
passing values 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,story_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("loggedID")%>></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
  #2  
Old September 18th, 2003, 12:51 PM
Vlince Vlince is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Location: Canada, Quebec, Montreal
Posts: 410 Vlince User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Ok so you have 3 buttons, and depending on which one is clicked you want to send the data of the <form>...</form> to a different ASP page right?

This is my *suggestion*:
remove from your <form>...</form> the action attribute and create 3 *regular buttons* NOT submits buttons, regular buttons.

Each *buttons* should have an onclick attribute like this:

<input type="button" name="btn1" value="Button1" onclick="MyButton1();">
<input type="button" name="btn2" value="Button2" onclick="MyButton2();">
<input type="button" name="btn3" value="Button3" onclick="MyButton3();">

Then inside the <head>...</head> portion of your code, you declare these 3 functions like so:
<head>
<script language="javascript">
function MyButton1()
{
//using javascript you'll submit the <form>...</form>
document.teacher.action = "welStudent.asp";
document.teacher.submit();
}

function MyButton2()
{
//using javascript you'll submit the <form>...</form>
document.teacher.action = "draftedStory.asp";
document.teacher.submit();
}

function MyButton3()
{
//using javascript you'll submit the <form>...</form>
document.teacher.action = "viewEditedStory.asp";
document.teacher.submit();
}
</script>
</head>

Now, the method I'm showing you here is NOT necessarily the best/only way, but it is a way so try it if you like!

Hope this helps!
Sincerely

Vlince

Reply With Quote
  #3  
Old September 18th, 2003, 01:22 PM
aspuser25 aspuser25 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 141 aspuser25 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
thanks for ur wonderful promt response. i implemented what u said but its giving error ...property not supported at:

document.teacher.submit();

Reply With Quote
  #4  
Old September 18th, 2003, 02:29 PM
Vlince Vlince is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Location: Canada, Quebec, Montreal
Posts: 410 Vlince User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Are you wainting for a reply???

If so I dunno what to tell you...DEBUG DEBUG

Create a simple ASP page with a <form>...</form>, then add a regular button with an *onclick* attribute calling a javascript function like in the example.

Start by making some *alert()* inside the function
then move towards, something like:
document.form_name.action = "test.asp"
document.form_name.submit();

See if it goes to test.asp ?
You need to try and DEBUG until *you* find out what's wrong!


Here nevermind, I'll do it...copy/paste this I've tested it an it works!

-------------------------------------------------
<%@ Language=VBScript %>

<html>
<head>
<script language=javascript>
<!--
function Button1()
{
//FOR DEBUG ONLY
//alert("I'm inside the function!")

document.frmMain.action = "test.asp"
document.frmMain.submit();
}
//-->
</script>
</head>
<body>

<form name="frmMain" method="post">

<input type="button" value="Button" name="btn1" onclick="Button1();">
</form>

</body>
</html>
----------------------------------------------------------------

I obviously didn't create the test.asp so I'm getting an HTTP 404 - File not found error!

Hope this helps!
Sincerely

Vlince

Reply With Quote
  #5  
Old September 18th, 2003, 04:34 PM
aspuser25 aspuser25 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 141 aspuser25 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Thumbs up

thanks vlince..it worked now.

gr8!!!
thanks for the superb help!

Reply With Quote
  #6  
Old September 18th, 2003, 10:38 PM
unatratnag unatratnag is offline
Average Intelligence
Dev Shed Novice (500 - 999 posts)
 
Join Date: Apr 2003
Location: Ohio/Chicago
Posts: 678 unatratnag User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 m 22 sec
Reputation Power: 6
Send a message via AIM to unatratnag
So you know what Vlince did,

<form name="frmMain" method="post">

you need the frmMain.submit()

you never named your form let alone sign a method or action to it. I think you need to review some basic post/get tutorials....

Reply With Quote
  #7  
Old September 20th, 2003, 11:41 PM
JHouse JHouse is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: Fort Collins, CO
Posts: 233 JHouse User rank is Corporal (100 - 500 Reputation Level)JHouse User rank is Corporal (100 - 500 Reputation Level)JHouse User rank is Corporal (100 - 500 Reputation Level)JHouse User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 19 h 51 m 5 sec
Reputation Power: 7
I'm going to read those tuts. This thread has be very helpful. Thanks all.
__________________
JHouse
www.GroundedGroup.com

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > passing values from one form to another-urgent!


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway