Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pull a Vbscript object into a Javascript function??

Status
Not open for further replies.

WorkrAnt

Programmer
Dec 27, 2004
6
US
I am trying to pull the "Quantity on Hand" value in Vbscript into my Javascript function. I have tried everything and its not working. Please help... Thanks!

Code:

<%@ LANGUAGE = "VBScript" %>
<!-- #include file="db.inc" -->
<!-- #include file="config.inc" -->

if stage="" or stage=null then
%>
.....blah blah
<tr>
<td align="left" width="75"><font face="Arial" size="2"><strong><b>Quantity On Hand:</b></strong></font></td>
<td align="right" width="97"><p align="left"><font size="2" face="arial"><%= rsprod("QOH") %> </font></td>
</tr>
</table>
<p><font face="Arial" size="2">How many of these do you want to order? </font></p>
<%

<script Language="JavaScript">
<!--
function FrontPage_Form1_Validator(theForm)
{
if (theForm.Qty.value > ????? )
{
alert("Quantity Ordered has exceeded the amount in Stock!");
theForm.Qty.focus();
return (false);
}
return (true);
}
//-->
</script>
....blah blah
 
Just a note, replace this:
if stage="" or stage=null then
By this:
if stage="" or IsNull(stage) then
Or this:
if Trim(stage & "")="" then

Your issue, now.
Have you tried to play with a global variable named, say QOH ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
I will try a global and see what happens. Im kinda new at this.

Thanks!
 
I used a global Javascript variable. And it worked. Thank you.


<script Language="JavaScript">
<!--
var QT = <%= rsprod("QOH") %>;

function FrontPage_Form1_Validator(theForm)
{
if (parseFloat(theForm.Qty.value) > QT)
{
alert("Please enter an amount less than the amount in stock.");
theForm.Qty.focus();
return (false);


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top