E-junkie - We help you sell online
World Class Solution - Damon @ PayPal
Sell & promote your productsJoin affiliate programs offered by sellers Shop Community
community home . login . register . forums . submit content
 

E-junkie Ecommerce Forums » E-junkie Discussions

Tag Cloud for this topic:

Validation & Overlay



GuestUser
member
Posts: 808


I've created an XML data structure incorporating item title and price as well as per-option images. It looks like this:

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


#
POSTED ON: November 16, 2007 @ 21:38 GMT -7




E-JunkieExpert
member
Posts: 804


In your usage of return EJEJC_lc(this); .. "this" is not in context anymore. You should replace "this" with the form name.


#
POSTED ON: November 16, 2007 @ 21:42 GMT -7


You must be logged in to make a post. Please click here to login.

about | contact | resell | terms of service | privacy policy © 2008 19.5 Degrees. All rights reserved.
Designated trademarks and brands are the property of their respective owners.
Use of this Web site constitutes acceptance of the Terms of Service and Privacy Policy.
PayPal Certified Integration Google Checkout Certified Integrattion 30 Day Money Back Guarantee
 Share this page!