Hey all,
I have succeeded in making one selection list dictate another (if any of you
remember my post about 2 weeks or so ago). Regardless, it does not work all
the time, yes it is intermittent. Myself and a co-worker have checked the
code many times, but find the code seems to be stable. We think there may
be a problem with the server and how the Response object is grabbing
information. I cannot find enough documentation on the asp-apache.org site
about the $Response->Flush() method, so im not sure if thats even where i
should be looking for solving this problem. Im sure there is somehting gon
on behind the scenes that a rookie is just missing. Please lend me a hand
if possible, the code is below...
Thanks a lot everyone,
Dan Augustine
my $compartment = $Request->QueryString("Compartment");
%>
<!--#include file=header.inc-->
<FORM NAME="Notes" METHOD="POST">
<%printList()%>
<P ALIGN="CENTER">
<INPUT TYPE="submit" value="Submit" onclick=<%save_to_file()%> >
<INPUT TYPE="submit" name="Button1" value="" onclick=<%RefreshPage()%>>
<INPUT TYPE="reset" value="Reset">
</P>
</FORM>
<!--#include file=footer.inc-->
<%
sub printList
{
print'<P ALIGN="CENTER">Compartment: ';
print'<SELECT NAME="Compartments"
onChange="document.Notes.Button1.click()" >';
print'<OPTION VALUE="-1">NONE</OPTION>';
for (my $i = 1; $i <= 3; $i++)
{
print'<OPTION ';
if ($compartment eq $i)
{
print'SELECTED VALUE="'.$i.'">compart '.$i.'</OPTION>';
}
else
{
print'VALUE="'.$i.'">compart '.$i.'</OPTION>';
}
}
print'</SELECT>';
print'</P>';
if ($compartment && $compartment > 0 )
{
$Response->Flush();
print'<P ALIGN="CENTER"> Machine: ';
print' ';
print'<SELECT NAME="Machines">';
if ($compartment eq 1) {compart1(); }
elsif ($compartment eq 2) {compart2(); }
elsif ($compartment eq 3) {compart3(); }
print'</SELECT>';
print'</P>';
}
print'<P ALIGN="CENTER">';
print'<TEXTAREA COLS=25 ROWS=4 WRAP="hard" NAME="feedback">';
print'</TEXTAREA>';
print'</P>';
print'<P ALIGN="CENTER">';
print'</P>';
}
sub RefreshPage
{
my $NewCompartment = $Request->Form('Compartments');
if ($NewCompartment) {
$Response->Redirect("Note.asp?Compartment=$NewCompartment");
}
}
sub compart1
{
print'<OPTION VALUE="1">Machine 1</OPTION>';
print'<OPTION VALUE="2">Machine 2</OPTION>';
print'<OPTION VALUE="3">Machine 3</OPTION>';
print'<OPTION VALUE="4">Machine 4</OPTION>';
}
sub compart2
{
print'<OPTION VALUE="5">Machine 5</OPTION>';
print'<OPTION VALUE="6">Machine 6</OPTION>';
print'<OPTION VALUE="7">Machine 7</OPTION>';
print'<OPTION VALUE="8">Machine 8</OPTION>';
}
sub compart3
{
print'<OPTION VALUE="9">Machine 9</OPTION>';
print'<OPTION VALUE="10">Machine 10</OPTION>';
print'<OPTION VALUE="11">Machine 11</OPTION>';
print'<OPTION VALUE="12">Machine 12</OPTION>';
}
sub save_to_file
{
my $machinenum = $Request->Form('Machines');
my $feedbk = $Request->Form('feedback');
my $NewCompartment = $Request->Form('Compartments');
if ($feedbk)
{
my $realtime = gmtime();
my $user = "Demo Demoson";
my $filename = "$TmpDir/notes.txt";
my $url = "Note.asp";
my $filename = "$TmpDir/notes.txt";
open(FILE, ">>$filename") || die("Can't open file for writing: $!");
flock(FILE, LOCK_EX);
print FILE "- Message Logged by: $user\n";
print FILE "- $realtime\n";
if ($NewCompartment > 0)
{
print FILE "- Compartment #$NewCompartment\n";
if ($machinenum)
{
print FILE "- Machine #$machinenum\n\n";
}
}
print FILE "$feedbk\n\n";
flock(FILE, LOCK_UN);
close FILE;
$Response->Redirect($url);
}
}
%>
____________________________________________________________________________
____________________
Daniel G. Augustine
Intern
RLW, Inc.
(814) 867-5122
(717)-314-6052 (mobile)
Pennsylvania State University
Undergraduate Student
School of Information Sciences and Technology
http://ist.psu.edu
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]