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

javaScript to prevent form submit with 0 value

Thread began 1/18/2013 3:38 pm by Roxana | Last modified 1/20/2013 8:00 pm by Roxana | 6143 views | 9 replies


javaScript to prevent form submit with 0 value

Hi there,

I noticed, that on my shop site it is possible to put items into the cart, even if their value is at $ 0.
To explain, some of the products require version and/or size selection, and the price of the selection is instantly displayed. So, if no selection is made, the price is at $ 0.00.

Now I am trying to prevent the page from submitting (putting items into the cart), if a necessary selection was not made and the displayed price is still at $ 0.

Having no javaScript training whatsoever, I concocted this from the internet:

<script type="text/javascript">
function checkForm() {
if (WA_eCart_DisplayMoney($shop, $row_rspricetable['price']); == "0") {
alert("Make a selection");
return false;


<form action="<?php echo $_SERVER["PHP_SELF"]; ?><?php echo (isset($_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] != "")?"?".$_SERVER["QUERY_STRING"]:""; ?>" onclick="checkForm();" method="post" name="shop_1_ATC_<?php echo $row_DetailRS1["product_id"]; ?>" id="segufix_1_ATC_<?php echo $row_DetailRS1["product_id"]; ?>" >

... where the "onclick" is the only thing I added, everything else was already there.

Could someone help me out?


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...