Hi Guys,
I just need a tiny bit of javascript re-written,
all it does is check the a size has been selected in a form..
The trouble is on the old site it was a drop down, and on my newly designed site it is a radio buttons so I think that is interfering.. I need a JavaScript expert.
The original function:-
The page in which I want the function to occur:-Code:function checkSizes() { for(i=0; i<document.main.elements.length; i++) { if ( document.main.elements[i].name.match(/^colour_(.*)$/) && document.main.elements[i].value ) { if ( document.getElementById("size_" + RegExp.$1).value == '' ) { alert ('Please choose a size for all your items'); return false; } } } }
Example Product Page
The form specifics:-
So can anyone either edit my code or create a new piece of JavaScript to perform this function?Code:<form action="basket.ghtml" method="post" name="main" target="_self" onsubmit="return checkSizes()"> [_foreach [_own Size_]_] <div class="buttons"> <input type="radio" name="size_[_own ID_]" value="[_value_]" class="styled" /> <div class="label"> <span class="nohover">[_value_]</span> <span class="onhover"></span> </div> </div> [_/foreach_] <input type="submit" name="action" value="Add to Basket" class="button" /> </form>
Thanks for your time.
Best Regards,
Pete




Reply With Quote
Bookmarks