E-Junkie Forum http://www.e-junkie.com/bb/ E-Junkie Forum RSS en-us Copyright 2008, 19.5 Degrees. All rights reserved. webmaster@e-junkie.com webmaster@e-junkie.com Thu, 18 Sep 2008 20:58:41 GMT Thu, 4 Dec 2008 07:10:56 GMT 681 E-JUNKIE 5 E-Junkie Forum http://www.e-junkie.com/bb/ http://www.e-junkie.com/ej/logo.gif 290 104 Post #2 http://www.e-junkie.com/bb/topic/2865/pg/0#post7745 http://www.e-junkie.com/bb/topic/2865/pg/0#post7745 Thu, 18 Sep 2008 20:58:41 GMT
So, the primart piece of code which triggers the cart is the EJEJC_lc function which is called by the onClick event of the button included in the form.

Check out the site mentioned at http://www.e-junkie.com/bb/topic/2793#post7437 .. they seem to have done that very well.]]>
E-junkie Discussions; E-junkieChef
Post #1 http://www.e-junkie.com/bb/topic/2865/pg/0#post7745 http://www.e-junkie.com/bb/topic/2865/pg/0#post7745 Wed, 17 Sep 2008 20:30:50 GMT
After browsing google and this forum, I found a link to http://www.elated.com/articles/form-validation-with-javascript/ , which seems promising. However, I cannot seem to make it work, and I think it is due to the fact that the "Add to Cart" button is running a javascript, not performing a post operation. Either way, I added a name to the form in the e-junkie button code, and then adapted the script in the example linked above to validate the os0 variable to verify that it is not blank.

Any ideas on what I am missing here?

I changed [code]<form action="https://www.e-junkie.com/ecom/gb.php......accept-charset="UTF-8">"[/code] to [code]"<form name="pay_online" action="https://www.e-junkie.com/ecom/gb.php......accept-charset="UTF-8" onsubmit="return validate_form ( );">"[/code]

and I added this script:

[code]<script language="javascript" type="text/javascript">
<!--

function validate_form ( )
{
valid = true;

if ( document.pay_online.os0.value == "" )
{
alert ( "Please provide your account number." );
valid = false;
}

return valid;
}

//-->
</script>[/code]]]>
E-junkie Discussions; trymes