Jump to content



Latest News: (loading..)

- - - - -

Qty box on product_info page error checking


  • Please log in to reply
1 reply to this topic

#1   PupStar

PupStar
  • Members
  • 558 posts
  • Real Name:Mark
  • Gender:Male

Posted Today, 01:17 PM

Hi Guys,

I am trying to figure out a way of adding some error checking to the quantity box I have on the product info page.

Maybe its easier done than I am thinking but being full of a head cold today is making things blurry urgh

So far I have this

<script type="text/javascript">
function cartqty(form) {
	 if (form.cartqty.value == "" ) {
		 alert("<?php echo BOX_QUANTITY_ERROR; ?>")
		 form.cartqty.focus();
		 return false;
		 }
	 else {
		 // form.submit()
		 return true;
		 }
}
</script>

<?php echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product'), 'onsubmit="return cartqty(this);"'); ?>

Maybe I am going about this wrong way but any advice would be appreciated.

Thanks

Mark

#2 ONLINE   burt

burt

    Code Monkey

  • Community Team
  • 7,726 posts
  • Real Name:G Burton
  • Gender:Male
  • Location:UK/DEV/on

Posted Today, 02:44 PM

What is it you want to do?  Ensure that the quantity passed is at least 1 ?
eBooks / Templates

Warning: My posts may contain Horsemeat.