Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Validate Product options??

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 12-09-2011, 08:24 PM
  ARW VISIONS's Avatar 
ARW VISIONS ARW VISIONS is offline
 

X-Man
  
Join Date: Jan 2007
Location: Pensacola, FL
Posts: 2,536
 

Default Validate Product options??

So i have about 20 product options and will have 500 - 600 products.

how can I validate them all using one script? don't want to have to put each product number and value in teh validation script.
__________________
xcart 5.1.2
Reply With Quote
  #2  
Old 12-09-2011, 08:35 PM
  ARW VISIONS's Avatar 
ARW VISIONS ARW VISIONS is offline
 

X-Man
  
Join Date: Jan 2007
Location: Pensacola, FL
Posts: 2,536
 

Default Re: Validate Product options??

ummmm... why is the value a number?

<option value="5908"> New Measurements </option>

this seems crazy. How am I going to validate all these product options? Am i going to have to know the value and product option number of 20 different options for 500 products?
__________________
xcart 5.1.2
Reply With Quote
  #3  
Old 12-10-2011, 05:30 AM
  ARW VISIONS's Avatar 
ARW VISIONS ARW VISIONS is offline
 

X-Man
  
Join Date: Jan 2007
Location: Pensacola, FL
Posts: 2,536
 

Default Re: Validate Product options??

Anyone? Was very doable in previous versions.
__________________
xcart 5.1.2
Reply With Quote
  #4  
Old 12-13-2011, 06:35 AM
  ARW VISIONS's Avatar 
ARW VISIONS ARW VISIONS is offline
 

X-Man
  
Join Date: Jan 2007
Location: Pensacola, FL
Posts: 2,536
 

Default Re: Validate Product options??

Used this. Also put it in a separate JS file so it would be global.

Code:
function validate_form(){ if (document.orderform[4].selectedIndex=='0') { alert('Please select whether you would like to use New Measurements or My Measurements.'); return false; } else if(document.orderform[4].selectedIndex=='1') { var elem = (document.orderform.elements); var nelem = (elem.length*1) - (3*1); for(var i = 0; i < nelem; i++) { if(document.orderform[i].type=='select-one') { if(document.orderform[i].selectedIndex=='0') { alert('Please select all options.'); return false; } } } } else return true; }
__________________
xcart 5.1.2
Reply With Quote
  #5  
Old 12-13-2011, 01:00 PM
  CottonAge.com's Avatar 
CottonAge.com CottonAge.com is offline
 

eXpert
  
Join Date: Jan 2008
Location: Orange County, California
Posts: 244
 

Default Re: Validate Product options??

did you figure this out?
__________________
CottonAge.com - v4.4.4 - Gold
Mirko.com - v4.1.12 - Gold

We sell Bathrobes, Slippers, Towels & more at wholesale prices...
Reply With Quote
  #6  
Old 12-13-2011, 01:10 PM
  ARW VISIONS's Avatar 
ARW VISIONS ARW VISIONS is offline
 

X-Man
  
Join Date: Jan 2007
Location: Pensacola, FL
Posts: 2,536
 

Default Re: Validate Product options??

yes used the above code to make all select boxes with a selected index of 0 alert please choose options.

you will probably have to revise.
__________________
xcart 5.1.2
Reply With Quote
  #7  
Old 12-13-2011, 01:33 PM
  CottonAge.com's Avatar 
CottonAge.com CottonAge.com is offline
 

eXpert
  
Join Date: Jan 2008
Location: Orange County, California
Posts: 244
 

Default Re: Validate Product options??

Ok, I was looking for something like this too. where i want my customers, If they select one option other will become mandatory
__________________
CottonAge.com - v4.4.4 - Gold
Mirko.com - v4.1.12 - Gold

We sell Bathrobes, Slippers, Towels & more at wholesale prices...
Reply With Quote
  #8  
Old 12-13-2011, 01:41 PM
  CottonAge.com's Avatar 
CottonAge.com CottonAge.com is offline
 

eXpert
  
Join Date: Jan 2008
Location: Orange County, California
Posts: 244
 

Default Re: Validate Product options??

but the way want is if the first option value is 1 then other option will be mandatory.
__________________
CottonAge.com - v4.4.4 - Gold
Mirko.com - v4.1.12 - Gold

We sell Bathrobes, Slippers, Towels & more at wholesale prices...
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 02:29 PM.

   

 
X-Cart forums © 2001-2020