X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Validation script (Javascript) (https://forum.x-cart.com/showthread.php?t=49812)

Cyber Matrix 09-21-2009 04:47 PM

Validation script (Javascript)
 
I'm using the validation box that is under the product options of the admin. However, is there way to put this in a tpl without having to put this for each product that needs it.

Code:

if (product_option('Hose Media').value == '')
{ alert('Please complete Hose Media (Ex. Water, Steam, etc.)');
return false;
}
if (product_option('Hose Working Pressure (PSI)').value == '')
{ alert('Please complete Hose Working Pressure (PSI)');
return false;
}
if (product_option('Hose Operating Temperature (F)').value == '')
{ alert('Please complete Hose Operating Temperature (F)');
return false;
}
if (document.getElementById('po454').selectedIndex == 0)
{ alert('Please select your 1st Fititng.'); return false;
}
if (document.getElementById('po455').selectedIndex == 0)
{ alert('Please select your 2nd Fititng.'); return false;
}
else return true;


By the way this is for a 4.2 cart

ARW VISIONS 09-21-2009 06:59 PM

Re: Validation script (Javascript)
 
I ahve done this before, but for teh life of me can't remember how I did it. I'll try to hunt it down for you.

Ash

ARW VISIONS 09-21-2009 07:18 PM

Re: Validation script (Javascript)
 
skin1/form_validation_js.tpl

you will need to change your code a bit, i believe.


All times are GMT -8. The time now is 05:32 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.