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 Sat, 17 Nov 2007 04:42:07 GMT Fri, 29 Aug 2008 02:26:49 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/734/pg/0#post1817 http://www.e-junkie.com/bb/topic/734/pg/0#post1817 Sat, 17 Nov 2007 04:42:07 GMT E-junkie Discussions; E-JunkieExpert Post #1 http://www.e-junkie.com/bb/topic/734/pg/0#post1817 http://www.e-junkie.com/bb/topic/734/pg/0#post1817 Sat, 17 Nov 2007 04:38:47 GMT
<items>
<item>
<id>43522</id>
<title>abc</title>
<category>xyz</category>
<price>0.00</price>
<image description="xyz">images/products/abc.jpg</image>
<optionsets>
<optionset value="Color" id="0">
<option value="abc1.jpg">Texas
Orange</option>
<option value="abc2.jpg">Charcoal</option>
</optionset>
<optionset id="1" value="Size">
<option value="sizes/size_s.gif">Small</option>
<option value="sizes/size_m.gif">Medium</option>
<option value="sizes/size_l.gif">Large</option>
<option value="sizes/size_xl.gif">Xtra Large</option>
<option value="sizes/size_2x.gif">XXtra Large</option>
</optionset>
</optionsets>
</item>
</items>

I re-create the form for items with optionsets or present a simple link for items without optionsets. I have replaced select inputs with a list of images with onclick handlers to set hidden inputs. This all works nicely, but I'd like to do a simple validation to ensure that the shopper has selected a color and image before the form is submitted. However, it's not obvious to me how to integrate this with the way you handle form submission. I'm replacing your image input onclick function with a call to return my own

validateForm():

<input type="image" src="images/ej/ej_add_to_cart.gif" onclick="javascript:return validateInput(this.parentNode);" />

<script type="text/javascript">
function validateInput(form) {
for (i=0;i<form.elements.length;i++) {
if (form.elements[i].value == '') {
alert("Please select a color and/or size by clicking the
icons");
return false;
}
}
return EJEJC_lc(this);
}

function EJEJC_lc(th) { return false; }

</script>

My alert works in that it prevents the submission from proceeding when the options haven't been selected, but is broken in that a validated submission makes the cart appear in another window rather than as an overlay - how do I validate and still get the overlay?]]>
E-junkie Discussions; GuestUser