|
 |
asp_databases thread: Vbscript - Alert function
Message #1 by "Nisha Nambiar" <nishanam@y...> on Tue, 24 Oct 2000 16:18:10 +0100
|
|
Hi
this page is an order entry form. I have displayed all the Items from the database and now I have text boxes like Quantity,extension
& Stickernumber which the user has to fill in. There is also a check box called replacement.
Whwn i submit the order I want to check if the Replacement checkbox is checked then there is something entered in the sticker number
text box or else I want to pop up a message box like "You must enter a stickerNumber"
I have VB script with alert function but its not working and I think its because of it could recognize the condition in the if
condition.
i am stuck.
Also I don't know how to write a JavaScript for this, if that has to be used.
Here is that part of code:
<SCRIPT LANGUAGE=VBSCRIPT RUNAT=SERVER>
Sub btnSubmit_onClick()
Dim rsItems
Dim strItem
Dim Conn
Set Conn = Server.CreateObject ("ADODB.Connection")
set rsItems = Server.CreateObject ("ADODB.Recordset")
Conn.Open "DSN=Reliacom;UID=sa;Pwd="
rsItems.Open "SELECT * FROM tblItems ",Conn
rsItems.MoveFirst
Do While Not rsItems.EOF
If frmPurchase."R" & rsItems("ItemName").Value = "on" Then
Alert "You must enter a MOI Sticker#"
frmPurchase."S" & rsItems("ItemName").Focus
Exit Sub
End if
rsItems.MoveNext
LOOP
call frmPurchase.Submit()
End sub
</SCRIPT>
Here is my entire page code.I know its too much for someone to read but I think this would help you understsnd what I am trying to
do.
<HTML>
<!-- #INCLUDE FILE = "adovbs.inc" -->
<HEAD>
<TITLE>Reliacom - Puchase Request</TITLE>
</HEAD>
<BODY BGCOLOR = "IVORY">
<FORM ACTION="PrintOrder.asp" METHOD=POST NAME="frmPurchase">
<%
'create and open the connection and the recordset
Dim Conn
Dim rsStore
Dim rsDept
Dim rsNextOrder
' Create coneection & recordset objects
Set Conn = Server.CreateObject ("ADODB.Connection")
Set rsStore = Server.CreateObject ("ADODB.Recordset")
set rsDept = Server.CreateObject ("ADODB.Recordset")
set rsNextOrder = Server.CreateObject ("ADODB.Recordset")
' Open the connection and recordset object
Conn.Open "DSN=Reliacom;UID=sa;Pwd="
rsStore.Open "SELECT * FROM tblStore", Conn
rsDept.Open "tblDepartment", Conn
rsNextOrder.Open "tblNextOrder", Conn
%>
<TABLE BORDER=0 WIDTH=100%>
<TR>
<TD></TD>
<TD></TD>
<TD><FONT FACE="Arial" Size="2"><% =NOW %></FONT></TD>
</TR>
<TD WIDTH=30%></TD>
<TD ALIGN=CENTER><FONT FACE="Arial" Size="6" COLOR="#0000CD">Reliacom</FONT></TD>
</TR>
<TR>
<TD></TD>
<TD ALIGN=CENTER><FONT FACE="Arial" Size="3" COLOR="#0000CD"><B>Purchase Request</B></FONT></TD>
</TR>
</TABLE><P>
<TABLE BORDER=0 WIDTH=55%>
<TR>
<TD><B>Requested By</B></TD>
<TD WIDTH=25%><B>Store</B></TD>
<TD><B>Department</B></TD>
</TR>
<TR>
<TD><INPUT TYPE="Text" NAME="RequestBy"></TD>
<TD><SELECT id=cboStore name=cboStore
onChange="cboStore_change()"><OPTION VALUE = ""></OPTION>
'load the combo-box with the storenumber
<%
While not rsStore.EOF
%>
<OPTION Value = "<% = rsStore.FIELDS("StoreNumber") %>">
<% = rsStore.FIELDS("StoreNumber") %></OPTION>
<%
rsStore.MoveNext
WEND
%>
</SELECT></TD>
<TD><SELECT id=cboDept name=cboDept
onChange="cboDept_change()"><OPTION VALUE = ""></OPTION>
'Load the DepartmentName in the Combo from Department table
<%
While not rsDept.EOF
%>
<OPTION Value = "<% = rsDept.FIELDS("DepartmentName") %>">
<% = rsDept.FIELDS("DepartmentName") %></OPTION>
<%
rsDept.MoveNext
WEND
%>
</SELECT></TD>
</TR>
</TABLE><P>
<TABLE BORDER=0 WIDTH=100%>
<TR>
<TD WIDTH=30%><B>Item</B></TD>
<TD WIDTH=12%><B>Price</B></TD>
<TD WIDTH=12%><B>Quantity</B></TD>
<TD WIDTH=15%><B>Extension</B></TD>
<TD WIDTH=15%><B>Repalcement</B></TD>
<TD><B>MOI Sticker#</B></TD>
</TR>
</TABLE>
<TABLE BORDER=0 WIDTH=100%>
<%
Dim rsCategory
set rsCategory = Server.CreateObject ("ADODB.Recordset")
rsCategory.Open "tblCategory", Conn
%>
<%
Do While Not rscategory.EOF
%>
<TR><TH ALIGN=LEFT COLSPAN=6><FONT SIZE = "4"><% = rsCategory("CategoryName")
%></FONT></TH></TR>
<%
Dim lngNumber
lngNumber = rscategory("categoryNumber")
%>
<%
Dim rsItems
set rsItems = Server.CreateObject ("ADODB.Recordset")
rsItems.Open "SELECT * FROM tblItems WHERE CategoryNumber =" & lngNumber , Conn
Do While Not rsItems.EOF
%>
<TR>
<TD WIDTH="30%"><% = rsItems("ItemName") %></TD>
<TD WIDTH="12%"><% = FormatCurrency(rsItems("ItemPrice")) %></TD>
<TD WIDTH="12%"><INPUT TYPE="Text" NAME="Q<%=rsItems("ItemName")%>" SIZE="5" value=0></TD>
<TD WIDTH="15%"><INPUT TYPE="Text" NAME="E<%=rsItems("ItemName")%>" SIZE="10"></TD>
<TD WIDTH="15%" ALIGN=CENTER><INPUT TYPE="CheckBox" NAME="R<%=rsItems("ItemName")%>"></TD>
<TD><INPUT TYPE="Text" NAME="S<%=rsItems("ItemName")%>" SIZE="10"></TD>
</TR>
<%
rsItems.MoveNext
Loop
%>
<%
rsCategory.MoveNext
Loop
rsCategory.Close
%>
</TABLE>
<p><BR>
<P><BR>
<P><BR>
<B>Reason for Request:</B><BR>
<CENTER><TEXTAREA NAME="Reason" COLS="60" ROWS="5" WRAP="VIRTUAL"></TEXTAREA><P></CENTER>
<CENTER><INPUT TYPE=button value="Print Order" NAME=btnSubmit onClick="btnSubmit_click()"></CENTER>
<%
rsStore.Close
rsDept.Close
rsNextOrder.Close
rsItems.Close
set rsStore = Nothing
Set rsDept = Nothing
set rsNextOrder = Nothing
Set rsItems = Nothing
Conn.Close
Set Conn = Nothing
%>
</FORM>
<SCRIPT LANGUAGE=VBSCRIPT RUNAT=SERVER>
Sub btnSubmit_onClick()
Dim rsItems
Dim strItem
Dim Conn
Set Conn = Server.CreateObject ("ADODB.Connection")
set rsItems = Server.CreateObject ("ADODB.Recordset")
Conn.Open "DSN=Reliacom;UID=sa;Pwd="
rsItems.Open "SELECT * FROM tblItems ",Conn
rsItems.MoveFirst
Do While Not rsItems.EOF
If frmPurchase."R" & rsItems("ItemName").Value = "on" Then
Alert "You must enter a MOI Sticker#"
frmPurchase."S" & rsItems("ItemName").Focus
Exit Sub
End if
rsItems.MoveNext
LOOP
call frmPurchase.Submit()
End sub
</SCRIPT>
</BODY>
</HTML>
I would appriciate the help
Thanks
Nisha
Message #2 by "Ken Schaefer" <ken@a...> on Wed, 25 Oct 2000 14:48:32 +1000
|
|
ASP runs on the server - *not* on the client. You can't make a box pop-up on
the client when the server is executing the code. All you can do is write
the necessary javascript to the page to generate a pop-up alert box to be
run on the client.
I suggest asking on a client-side javascript list (Wrox has one of these) if
you need the javascript.
Cheers
Ken
----- Original Message -----
From: "Nisha Nambiar" <nishanam@y...>
To: "ASP Databases" <asp_databases@p...>
Sent: Wednesday, October 25, 2000 1:18 AM
Subject: [asp_databases] Vbscript - Alert function
> Hi
> this page is an order entry form. I have displayed all the Items from the
database and now I have text boxes like Quantity,extension & Stickernumber
which the user has to fill in. There is also a check box called replacement.
> Whwn i submit the order I want to check if the Replacement checkbox is
checked then there is something entered in the sticker number text box or
else I want to pop up a message box like "You must enter a stickerNumber"
> I have VB script with alert function but its not working and I think its
because of it could recognize the condition in the if condition.
> i am stuck.
> Also I don't know how to write a JavaScript for this, if that has to be
used.
> Here is that part of code:
>
> <SCRIPT LANGUAGE=VBSCRIPT RUNAT=SERVER>
> Sub btnSubmit_onClick()
> Dim rsItems
> Dim strItem
> Dim Conn
> Set Conn = Server.CreateObject ("ADODB.Connection")
> set rsItems = Server.CreateObject ("ADODB.Recordset")
> Conn.Open "DSN=Reliacom;UID=sa;Pwd="
> rsItems.Open "SELECT * FROM tblItems ",Conn
> rsItems.MoveFirst
>
> Do While Not rsItems.EOF
> If frmPurchase."R" & rsItems("ItemName").Value = "on" Then
> Alert "You must enter a MOI Sticker#"
> frmPurchase."S" & rsItems("ItemName").Focus
> Exit Sub
> End if
> rsItems.MoveNext
> LOOP
>
> call frmPurchase.Submit()
> End sub
>
> </SCRIPT>
Message #3 by Maxime Bombardier <BombardierM@s...> on Wed, 25 Oct 2000 10:20:37 -0400
|
|
As it was mentionned, ASP is server-side, thus it won't give you the ability
to have a client-side box.
Beside that, VBScript does not have an alert function but has the MsgBox
function which would run only on IE (or WSH or any other client-side
engine). Netscape will not understand this but will understand the alert
(no capital A) from the JavaScript runtime.
If you wish to process an error on the server-side and then show a
client-side box upon reload of the page; it's a little bit tricky since your
ASP VBScript will then generate client-side JavaScript! Usually, ASP
developers would rather use a simple error message on screen than poping up
a box (users tends to find those boxes annoying anyway).
The last solution is that boxes could be appropriate for simple client-side
validation (done in JavaScript for browser neutral compatibility) which
could, for example, verify if a field was filled or empty, verify that you
have only numbers for american ZIP, etc. It is much faster to the user (and
server) since no round-trip to the server is required.
Maxime Bombardier, MCSD, MCDBA, MCSE+I
Senior Computer Systems Analyst
Sintaks, a Canon U.S.A. division
xxx.xxx.xxxx (228)
-----Original Message-----
From: Nisha Nambiar [mailto:nishanam@y...]
Sent: Tuesday, October 24, 2000 11:18 AM
To: ASP Databases
Subject: [asp_databases] Vbscript - Alert function
Hi
this page is an order entry form. I have displayed all the Items from the
database and now I have text boxes like Quantity,extension & Stickernumber
which the user has to fill in. There is also a check box called replacement.
Whwn i submit the order I want to check if the Replacement checkbox is
checked then there is something entered in the sticker number text box or
else I want to pop up a message box like "You must enter a stickerNumber"
I have VB script with alert function but its not working and I think its
because of it could recognize the condition in the if condition.
i am stuck.
Also I don't know how to write a JavaScript for this, if that has to be
used.
Here is that part of code:
<SCRIPT LANGUAGE=VBSCRIPT RUNAT=SERVER>
Sub btnSubmit_onClick()
Dim rsItems
Dim strItem
Dim Conn
Set Conn = Server.CreateObject ("ADODB.Connection")
set rsItems = Server.CreateObject ("ADODB.Recordset")
Conn.Open "DSN=Reliacom;UID=sa;Pwd="
rsItems.Open "SELECT * FROM tblItems ",Conn
rsItems.MoveFirst
Do While Not rsItems.EOF
If frmPurchase."R" & rsItems("ItemName").Value = "on" Then
Alert "You must enter a MOI Sticker#"
frmPurchase."S" & rsItems("ItemName").Focus
Exit Sub
End if
rsItems.MoveNext
LOOP
call frmPurchase.Submit()
End sub
</SCRIPT>
Here is my entire page code.I know its too much for someone to read but I
think this would help you understsnd what I am trying to do.
<HTML>
<!-- #INCLUDE FILE = "adovbs.inc" -->
<HEAD>
<TITLE>Reliacom - Puchase Request</TITLE>
</HEAD>
<BODY BGCOLOR = "IVORY">
<FORM ACTION="PrintOrder.asp" METHOD=POST NAME="frmPurchase">
<%
'create and open the connection and the recordset
Dim Conn
Dim rsStore
Dim rsDept
Dim rsNextOrder
' Create coneection & recordset objects
Set Conn = Server.CreateObject ("ADODB.Connection")
Set rsStore = Server.CreateObject ("ADODB.Recordset")
set rsDept = Server.CreateObject ("ADODB.Recordset")
set rsNextOrder = Server.CreateObject ("ADODB.Recordset")
' Open the connection and recordset object
Conn.Open "DSN=Reliacom;UID=sa;Pwd="
rsStore.Open "SELECT * FROM tblStore", Conn
rsDept.Open "tblDepartment", Conn
rsNextOrder.Open "tblNextOrder", Conn
%>
<TABLE BORDER=0 WIDTH=100%>
<TR>
<TD></TD>
<TD></TD>
<TD><FONT FACE="Arial" Size="2"><% =NOW %></FONT></TD>
</TR>
<TD WIDTH=30%></TD>
<TD ALIGN=CENTER><FONT FACE="Arial" Size="6"
COLOR="#0000CD">Reliacom</FONT></TD>
</TR>
<TR>
<TD></TD>
<TD ALIGN=CENTER><FONT FACE="Arial" Size="3" COLOR="#0000CD"><B>Purchase
Request</B></FONT></TD>
</TR>
</TABLE><P>
<TABLE BORDER=0 WIDTH=55%>
<TR>
<TD><B>Requested By</B></TD>
<TD WIDTH=25%><B>Store</B></TD>
<TD><B>Department</B></TD>
</TR>
<TR>
<TD><INPUT TYPE="Text" NAME="RequestBy"></TD>
<TD><SELECT id=cboStore name=cboStore
onChange="cboStore_change()"><OPTION VALUE = ""></OPTION>
'load the combo-box with the storenumber
<%
While not rsStore.EOF
%>
<OPTION Value = "<% = rsStore.FIELDS("StoreNumber") %>">
<% = rsStore.FIELDS("StoreNumber") %></OPTION>
<%
rsStore.MoveNext
WEND
%>
</SELECT></TD>
<TD><SELECT id=cboDept name=cboDept
onChange="cboDept_change()"><OPTION VALUE = ""></OPTION>
'Load the DepartmentName in the Combo from Department table
<%
While not rsDept.EOF
%>
<OPTION Value = "<% = rsDept.FIELDS("DepartmentName") %>">
<% = rsDept.FIELDS("DepartmentName") %></OPTION>
<%
rsDept.MoveNext
WEND
%>
</SELECT></TD>
</TR>
</TABLE><P>
<TABLE BORDER=0 WIDTH=100%>
<TR>
<TD WIDTH=30%><B>Item</B></TD>
<TD WIDTH=12%><B>Price</B></TD>
<TD WIDTH=12%><B>Quantity</B></TD>
<TD WIDTH=15%><B>Extension</B></TD>
<TD WIDTH=15%><B>Repalcement</B></TD>
<TD><B>MOI Sticker#</B></TD>
</TR>
</TABLE>
<TABLE BORDER=0 WIDTH=100%>
<%
Dim rsCategory
set rsCategory = Server.CreateObject ("ADODB.Recordset")
rsCategory.Open "tblCategory", Conn
%>
<%
Do While Not rscategory.EOF
%>
<TR><TH ALIGN=LEFT COLSPAN=6><FONT SIZE = "4"><%
rsCategory("CategoryName") %></FONT></TH></TR>
<%
Dim lngNumber
lngNumber = rscategory("categoryNumber")
%>
<%
Dim rsItems
set rsItems = Server.CreateObject ("ADODB.Recordset")
rsItems.Open "SELECT * FROM tblItems WHERE CategoryNumber =" & lngNumber ,
Conn
Do While Not rsItems.EOF
%>
<TR>
<TD WIDTH="30%"><% = rsItems("ItemName") %></TD>
<TD WIDTH="12%"><% = FormatCurrency(rsItems("ItemPrice")) %></TD>
<TD WIDTH="12%"><INPUT TYPE="Text" NAME="Q<%=rsItems("ItemName")%>" SIZE="5"
value=0></TD>
<TD WIDTH="15%"><INPUT TYPE="Text" NAME="E<%=rsItems("ItemName")%>"
SIZE="10"></TD>
<TD WIDTH="15%" ALIGN=CENTER><INPUT TYPE="CheckBox"
NAME="R<%=rsItems("ItemName")%>"></TD>
<TD><INPUT TYPE="Text" NAME="S<%=rsItems("ItemName")%>" SIZE="10"></TD>
</TR>
<%
rsItems.MoveNext
Loop
%>
<%
rsCategory.MoveNext
Loop
rsCategory.Close
%>
</TABLE>
<p><BR>
<P><BR>
<P><BR>
&nbs
p;
&nbs
p;
<B>Reason for Request:</B><BR>
<CENTER><TEXTAREA NAME="Reason" COLS="60" ROWS="5"
WRAP="VIRTUAL"></TEXTAREA><P></CENTER>
<CENTER><INPUT TYPE=button value="Print Order" NAME=btnSubmit
onClick="btnSubmit_click()"></CENTER>
<%
rsStore.Close
rsDept.Close
rsNextOrder.Close
rsItems.Close
set rsStore = Nothing
Set rsDept = Nothing
set rsNextOrder = Nothing
Set rsItems = Nothing
Conn.Close
Set Conn = Nothing
%>
</FORM>
<SCRIPT LANGUAGE=VBSCRIPT RUNAT=SERVER>
Sub btnSubmit_onClick()
Dim rsItems
Dim strItem
Dim Conn
Set Conn = Server.CreateObject ("ADODB.Connection")
set rsItems = Server.CreateObject ("ADODB.Recordset")
Conn.Open "DSN=Reliacom;UID=sa;Pwd="
rsItems.Open "SELECT * FROM tblItems ",Conn
rsItems.MoveFirst
Do While Not rsItems.EOF
If frmPurchase."R" & rsItems("ItemName").Value = "on" Then
Alert "You must enter a MOI Sticker#"
frmPurchase."S" & rsItems("ItemName").Focus
Exit Sub
End if
rsItems.MoveNext
LOOP
call frmPurchase.Submit()
End sub
</SCRIPT>
</BODY>
</HTML>
I would appriciate the help
Thanks
Nisha
Message #4 by Gregory_Griffiths@c... on Wed, 25 Oct 2000 16:03:06 +0100
|
|
You should never rely on any client side coding only to validate data,
even if you are on an intranet. It is very easy for a user to
circumvent (save the page and hack the HTML) or for a developer later
to alter your page and invalidate some or all of your checks for
example.
I agree that it can be useful, but only if it is backed up by server
side validation to double check and play safe, this may imapct the
performance of your application, but it can be productive in the long
run.
The authors of the O'Rielly CGI Programming book have the same view,
will try to find the page ref tonight.
> -----Original Message-----
> From: BombardierM@s... [mailto:BombardierM@s...]
> Sent: 25 October 2000 15:21
> To: BombardierM@s...; asp_databases@p...
> Subject: [asp_databases] RE: Vbscript - Alert function
>
>
> As it was mentionned, ASP is server-side, thus it won't give
> you the ability
> to have a client-side box.
>
> Beside that, VBScript does not have an alert function but has
> the MsgBox
> function which would run only on IE (or WSH or any other client-side
> engine). Netscape will not understand this but will
> understand the alert
> (no capital A) from the JavaScript runtime.
>
> If you wish to process an error on the server-side and then show a
> client-side box upon reload of the page; it's a little bit
> tricky since your
> ASP VBScript will then generate client-side JavaScript! Usually, ASP
> developers would rather use a simple error message on screen
> than poping up
> a box (users tends to find those boxes annoying anyway).
>
> The last solution is that boxes could be appropriate for
> simple client-side
> validation (done in JavaScript for browser neutral
> compatibility) which
> could, for example, verify if a field was filled or empty,
> verify that you
> have only numbers for american ZIP, etc. It is much faster
> to the user (and
> server) since no round-trip to the server is required.
>
>
>
> Maxime Bombardier, MCSD, MCDBA, MCSE+I
> Senior Computer Systems Analyst
> Sintaks, a Canon U.S.A. division
> xxx.xxx.xxxx (228)
>
> -----Original Message-----
> From: Nisha Nambiar [mailto:nishanam@y...]
> Sent: Tuesday, October 24, 2000 11:18 AM
> To: ASP Databases
> Subject: [asp_databases] Vbscript - Alert function
>
>
> Hi
> this page is an order entry form. I have displayed all the
> Items from the
> database and now I have text boxes like Quantity,extension &
> Stickernumber
> which the user has to fill in. There is also a check box
> called replacement.
> Whwn i submit the order I want to check if the Replacement checkbox is
> checked then there is something entered in the sticker number
> text box or
> else I want to pop up a message box like "You must enter a
> stickerNumber"
> I have VB script with alert function but its not working and
> I think its
> because of it could recognize the condition in the if condition.
> i am stuck.
> Also I don't know how to write a JavaScript for this, if that
> has to be
> used.
> Here is that part of code:
>
> <SCRIPT LANGUAGE=VBSCRIPT RUNAT=SERVER>
> Sub btnSubmit_onClick()
> Dim rsItems
> Dim strItem
> Dim Conn
> Set Conn = Server.CreateObject ("ADODB.Connection")
> set rsItems = Server.CreateObject ("ADODB.Recordset")
> Conn.Open "DSN=Reliacom;UID=sa;Pwd="
> rsItems.Open "SELECT * FROM tblItems ",Conn
> rsItems.MoveFirst
>
> Do While Not rsItems.EOF
> If frmPurchase."R" & rsItems("ItemName").Value = "on" Then
> Alert "You must enter a MOI Sticker#"
> frmPurchase."S" & rsItems("ItemName").Focus
> Exit Sub
> End if
> rsItems.MoveNext
> LOOP
>
> call frmPurchase.Submit()
> End sub
>
> </SCRIPT>
>
>
> Here is my entire page code.I know its too much for someone
> to read but I
> think this would help you understsnd what I am trying to do.
>
>
> <HTML>
>
> <!-- #INCLUDE FILE = "adovbs.inc" -->
>
> <HEAD>
> <TITLE>Reliacom - Puchase Request</TITLE>
> </HEAD>
> <BODY BGCOLOR = "IVORY">
> <FORM ACTION="PrintOrder.asp" METHOD=POST NAME="frmPurchase">
> <%
> 'create and open the connection and the recordset
> Dim Conn
> Dim rsStore
> Dim rsDept
> Dim rsNextOrder
>
> ' Create coneection & recordset objects
> Set Conn = Server.CreateObject ("ADODB.Connection")
> Set rsStore = Server.CreateObject ("ADODB.Recordset")
> set rsDept = Server.CreateObject ("ADODB.Recordset")
> set rsNextOrder = Server.CreateObject ("ADODB.Recordset")
>
> ' Open the connection and recordset object
> Conn.Open "DSN=Reliacom;UID=sa;Pwd="
> rsStore.Open "SELECT * FROM tblStore", Conn
> rsDept.Open "tblDepartment", Conn
> rsNextOrder.Open "tblNextOrder", Conn
> %>
>
> <TABLE BORDER=0 WIDTH=100%>
> <TR>
> <TD></TD>
> <TD></TD>
> <TD><FONT FACE="Arial" Size="2"><% =NOW %></FONT></TD>
> </TR>
> <TD WIDTH=30%></TD>
> <TD ALIGN=CENTER><FONT FACE="Arial" Size="6"
> COLOR="#0000CD">Reliacom</FONT></TD>
> </TR>
> <TR>
> <TD></TD>
> <TD ALIGN=CENTER><FONT FACE="Arial" Size="3"
> COLOR="#0000CD"><B>Purchase
> Request</B></FONT></TD>
> </TR>
> </TABLE><P>
>
> <TABLE BORDER=0 WIDTH=55%>
> <TR>
> <TD><B>Requested By</B></TD>
> <TD WIDTH=25%><B>Store</B></TD>
> <TD><B>Department</B></TD>
> </TR>
> <TR>
> <TD><INPUT TYPE="Text" NAME="RequestBy"></TD>
> <TD><SELECT id=cboStore name=cboStore
> onChange="cboStore_change()"><OPTION VALUE = ""></OPTION>
>
> 'load the combo-box with the storenumber
> <%
> While not rsStore.EOF
> %>
> <OPTION Value = "<% = rsStore.FIELDS("StoreNumber") %>">
> <% = rsStore.FIELDS("StoreNumber") %></OPTION>
> <%
> rsStore.MoveNext
> WEND
> %>
> </SELECT></TD>
>
> <TD><SELECT id=cboDept name=cboDept
> onChange="cboDept_change()"><OPTION VALUE = ""></OPTION>
> 'Load the DepartmentName in the Combo from Department table
> <%
> While not rsDept.EOF
> %>
> <OPTION Value = "<% = rsDept.FIELDS("DepartmentName") %>">
> <% = rsDept.FIELDS("DepartmentName") %></OPTION>
> <%
> rsDept.MoveNext
> WEND
> %>
> </SELECT></TD>
> </TR>
> </TABLE><P>
>
> <TABLE BORDER=0 WIDTH=100%>
> <TR>
> <TD WIDTH=30%><B>Item</B></TD>
> <TD WIDTH=12%><B>Price</B></TD>
> <TD WIDTH=12%><B>Quantity</B></TD>
> <TD WIDTH=15%><B>Extension</B></TD>
> <TD WIDTH=15%><B>Repalcement</B></TD>
> <TD><B>MOI Sticker#</B></TD>
> </TR>
> </TABLE>
>
> <TABLE BORDER=0 WIDTH=100%>
> <%
> Dim rsCategory
> set rsCategory = Server.CreateObject ("ADODB.Recordset")
> rsCategory.Open "tblCategory", Conn
> %>
>
> <%
> Do While Not rscategory.EOF
> %>
> <TR><TH ALIGN=LEFT COLSPAN=6><FONT SIZE = "4"><%
> rsCategory("CategoryName") %></FONT></TH></TR>
> <%
> Dim lngNumber
> lngNumber = rscategory("categoryNumber")
> %>
>
> <%
> Dim rsItems
> set rsItems = Server.CreateObject ("ADODB.Recordset")
> rsItems.Open "SELECT * FROM tblItems WHERE CategoryNumber ="
> & lngNumber ,
> Conn
> Do While Not rsItems.EOF
> %>
>
> <TR>
> <TD WIDTH="30%"><% = rsItems("ItemName") %></TD>
> <TD WIDTH="12%"><% = FormatCurrency(rsItems("ItemPrice")) %></TD>
> <TD WIDTH="12%"><INPUT TYPE="Text"
> NAME="Q<%=rsItems("ItemName")%>" SIZE="5"
> value=0></TD>
> <TD WIDTH="15%"><INPUT TYPE="Text" NAME="E<%=rsItems("ItemName")%>"
> SIZE="10"></TD>
> <TD WIDTH="15%" ALIGN=CENTER><INPUT TYPE="CheckBox"
> NAME="R<%=rsItems("ItemName")%>"></TD>
> <TD><INPUT TYPE="Text" NAME="S<%=rsItems("ItemName")%>"
> SIZE="10"></TD>
> </TR>
>
> <%
> rsItems.MoveNext
> Loop
> %>
>
> <%
> rsCategory.MoveNext
> Loop
> rsCategory.Close
> %>
> </TABLE>
> <p><BR>
> <P><BR>
> <P><BR>
> &n
> bsp; &nbs
> p;
> &n
> bsp; &nbs
> p;
> <B>Reason for Request:</B><BR>
> <CENTER><TEXTAREA NAME="Reason" COLS="60" ROWS="5"
> WRAP="VIRTUAL"></TEXTAREA><P></CENTER>
> <CENTER><INPUT TYPE=button value="Print Order" NAME=btnSubmit
> onClick="btnSubmit_click()"></CENTER>
>
> <%
> rsStore.Close
> rsDept.Close
> rsNextOrder.Close
> rsItems.Close
> set rsStore = Nothing
> Set rsDept = Nothing
> set rsNextOrder = Nothing
> Set rsItems = Nothing
> Conn.Close
> Set Conn = Nothing
> %>
>
> </FORM>
>
> <SCRIPT LANGUAGE=VBSCRIPT RUNAT=SERVER>
> Sub btnSubmit_onClick()
> Dim rsItems
> Dim strItem
> Dim Conn
> Set Conn = Server.CreateObject ("ADODB.Connection")
> set rsItems = Server.CreateObject ("ADODB.Recordset")
> Conn.Open "DSN=Reliacom;UID=sa;Pwd="
> rsItems.Open "SELECT * FROM tblItems ",Conn
> rsItems.MoveFirst
>
> Do While Not rsItems.EOF
> If frmPurchase."R" & rsItems("ItemName").Value = "on" Then
> Alert "You must enter a MOI Sticker#"
> frmPurchase."S" & rsItems("ItemName").Focus
> Exit Sub
> End if
> rsItems.MoveNext
> LOOP
>
> call frmPurchase.Submit()
> End sub
>
> </SCRIPT>
>
> </BODY>
> </HTML>
>
> I would appriciate the help
> Thanks
> Nisha
>
>
|
|
 |