close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Restricting quantity based on number of items in stock?

Thread began 2/24/2011 5:30 am by Nathon Jones Web Design | Last modified 3/15/2011 1:54 pm by Nathon Jones Web Design | 1543 views | 9 replies

Nathon Jones Web Design

Syntax error?

Thank you Jason.

I've getting a syntax error with that...

Microsoft VBScript compilation (0x800A03EA)
Syntax error
/springparknursery/plant-information.asp, line 16, column 79
WAFV_Errors = WAFV_Errors & WAValidateNM(cStr(Request.Form("qtyAvail")) & "",0,<%= Request.Form("qtyAvail")

I assume this is because I am using a form variable as the maximum number value?

How do I set the maximum number to be the hidden form element? I notice the default is set to 100, but when I insert <%= Request.Form("qtyAvail") %> it generates the syntax error.

Hope you can help with that. Thanks.


I've tried changing the line of code to the following:
WAFV_Errors = WAFV_Errors & WAValidateNM(cStr(Request.Form("spCART_1_Quantity_Add")) & "",0,Request.Form("qtyAvail"),"",",.",true,1)

...but, whilst this no longer produces a syntax error, the validation doesn't work.

Here's the code for my Add to Cart button:

<form name="spCART_1_ATC_<%=rsH.Fields("heatherID").value%>" method="post" action="<%=cStr(Request.ServerVariables("SCRIPT_NAME"))%><%=WA_eCart_IIf((Request.ServerVariables("QUERY_STRING") <> ""), "?" & Request.ServerVariables("QUERY_STRING"), "")%>">
<input type="hidden" name="spCART_1_ID_Add" value="<%=rsH.Fields("heatherID").value%>" />
<p>Quantity: <br />
<input type="text" name="spCART_1_Quantity_Add" value="1" size="6" style="width: 40px;height: 20px;border: 2px solid #BACBBE;padding: 6px 0px 6px 8px;margin: 0;color: #18440D;font:14px Arial, Helvetica, sans-serif;font-weight: normal;vertical-align:middle;" />
<input type="image" src="heather-plants/btn-addtobasket.png" value="Add to Cart" name="spCART_1_ATC" alt="Add to Basket" style="vertical-align:middle;" />
<input name="qtyAvail" type="hidden" id="qtyAvail" value="<%=(rsH.Fields.Item("heatherinstock").Value)%>" />

...and here is the server validation code:

if (cStr(Request.Form("spCART_1_ATC.x")) <> "") then
WAFV_Redirect = "plant-information.asp"
Session("WAVT_plantinformation_Errors") = ""
if (WAFV_Redirect = "") then
WAFV_Redirect = cStr(Request.ServerVariables("SCRIPT_NAME"))
end if
WAFV_Errors = ""
WAFV_Errors = WAFV_Errors & WAValidateNM(cStr(Request.Form("spCART_1_Quantity_Add")) & "",0,Request.Form("qtyAvail"),"",",.",true,1)

if (WAFV_Errors<> "") then
PostResult WAFV_Redirect,WAFV_Errors,"plantinformation"
end if
end if

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question





Ease of use


security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...