![]() |
![]() |
||||||
|
|||||||
| Tags: cart, minimum, order, shopping |
![]() |
|
|||
|
I have a shopping cart page and I want to apply a minimum order restriction
of $6 to it. The form tag looks like this - <form action="<?php echo ($_SERVER["PHP_SELF"].(isset($_SERVER["QUERY_STRING"])?"?".htmlentities($_SERVER["QUERY_STRING"]):""));?>" method="post" onSubmit="minimumCheck(<?php echo $ADTCart->TotalColumn("TotalPrice") ?>)"> The function itself is this - <script type="text/javascript"> function minimumCheck(value) { if (value < 6.00) { alert("There is a $6.00 minimum order at blahblahblah.com"); return false; } } </script> The javascript fires, and pops the alert, but the form submits! Why is that return false not kicking in? -- Murray --- ICQ 71997575 Adobe Community Expert (If you *MUST* email me, don't LAUGH when you do so!) ================== http://www.projectseven.com/go - DW FAQs, Tutorials & Resources http://www.dwfaq.com - DW FAQs, Tutorials & Resources ================== |
| Sponsored Links |
|
|||
|
Got it - changed the function to this -
<script type="text/javascript"> function minimumCheck(value) { if (value < 6.00) { alert("There is a $6.00 minimum order at Armydogtags.com"); return false; } return true; } </script> and the form tag to this - onSubmit="return(minimumCheck(<?php echo $ADTCart->TotalColumn("TotalPrice") ?>))"> -- Murray --- ICQ 71997575 Adobe Community Expert (If you *MUST* email me, don't LAUGH when you do so!) ================== http://www.projectseven.com/go - DW FAQs, Tutorials & Resources http://www.dwfaq.com - DW FAQs, Tutorials & Resources ================== "Murray *ACE*" <forums@HAHAgreat-web-sights.com> wrote in message news:g6aeup$q41$1@forums.macromedia.com... >I have a shopping cart page and I want to apply a minimum order restriction >of $6 to it. The form tag looks like this - > > <form action="<?php echo > ($_SERVER["PHP_SELF"].(isset($_SERVER["QUERY_STRING"])?"?".htmlentities($_SERVER["QUERY_STRING"]):""));?>" > method="post" onSubmit="minimumCheck(<?php echo > $ADTCart->TotalColumn("TotalPrice") ?>)"> > > The function itself is this - > > <script type="text/javascript"> > function minimumCheck(value) { > if (value < 6.00) { > alert("There is a $6.00 minimum order at blahblahblah.com"); > return false; > } > } > </script> > > > The javascript fires, and pops the alert, but the form submits! Why is > that return false not kicking in? > > -- > Murray --- ICQ 71997575 > Adobe Community Expert > (If you *MUST* email me, don't LAUGH when you do so!) > ================== > http://www.projectseven.com/go - DW FAQs, Tutorials & Resources > http://www.dwfaq.com - DW FAQs, Tutorials & Resources > ================== > > |
|
|||
|
Murray *ACE* wrote:
> Got it - changed the function to this - > > <script type="text/javascript"> > function minimumCheck(value) { > if (value < 6.00) { > alert("There is a $6.00 minimum order at Armydogtags.com"); > return false; > } > return true; > } > </script> > > and the form tag to this - > > onSubmit="return(minimumCheck(<?php echo > $ADTCart->TotalColumn("TotalPrice") ?>))"> > > There should be a space between return and "(": onSubmit="return minimumCheck(<?php echo $ADTCart->TotalColumn("TotalPrice") ?>);"> Mick |
|
|||
|
Ahh - thanks, Mick. Turns out the cart has multiple ways to submit the form
(clear, update, keep shopping, and checkout) so having it on the onsubmit event was not optimal. I moved it to the checkout button, and it works a treat, I think! -- Murray --- ICQ 71997575 Adobe Community Expert (If you *MUST* email me, don't LAUGH when you do so!) ================== http://www.projectseven.com/go - DW FAQs, Tutorials & Resources http://www.dwfaq.com - DW FAQs, Tutorials & Resources ================== "Michael White" <mwhite13@rochester.rr.com> wrote in message news:g6au28$coa$1@forums.macromedia.com... > Murray *ACE* wrote: >> Got it - changed the function to this - >> >> <script type="text/javascript"> >> function minimumCheck(value) { >> if (value < 6.00) { >> alert("There is a $6.00 minimum order at Armydogtags.com"); >> return false; >> } >> return true; >> } >> </script> >> >> and the form tag to this - >> >> onSubmit="return(minimumCheck(<?php echo >> $ADTCart->TotalColumn("TotalPrice") ?>))"> >> >> > There should be a space between return and "(": > > onSubmit="return minimumCheck(<?php echo > $ADTCart->TotalColumn("TotalPrice") ?>);"> > > Mick |
![]() |
| Thread Tools | |
| Display Modes | |
|
|
- Contact Us
-|-
Adobe Dreamweaver Forums -|-
Archive -|-
Top -|-Rules/Disclaimer-|-Help/Support-|-Advertise