Welcome, Guest ( Customer Panel | Login )




 All Forums
 VPCart Forum
 Customization
 Trouble with logic
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

ProductivePC
VP-CART New User

USA
199 Posts

Posted - August 31 2005 :  04:23:25  Show Profile  Visit ProductivePC's Homepage  Reply with Quote


I think I may have a fix for this one. If I put an IF statement in front of the state and make it equal to US or Canada then it will require the state or province... that should work.


Okay, I don't know why the code enclosures are not working however
I am having a little difficulty with attempting to check something
in a form. I would like to have the cart check to see if there is a
a certain country selected first prior to requiring a state or
province in the form field. I know how to ask it but apparently I
am writing it incorrectly.


Here is the partial code in question:

arrCart(cshipstate,i) = Request.Form("strState_"& i)
If arrCart(cshipstate,i) = "" or arrCart(cshipstate,i)="----- CANADA ----" Then
sError = sError & "<li>) Gift " & i & ": " & getlang("langCustState") & getlang("langCustRequired") & "<br>"
End If

Now, it would make sense to me that I would could do this a couple of ways but they don't seem to be working.
I have attempted

arrCart(cshipcountry,i) = Request.Form("strCountry_"& i)
arrCart(cshipstate,i) = Request.Form("strState_"& i)
If (arrCart(cshipstate,i) = "" AND arrCart(cshipcountry,i) = "United States") OR (arrCart(cshipstate,i) = "" AND arrCart(cshipcountry,i) = "Canada") OR (arrCart(cshipstate,i)="----- CANADA ----" Then
sError = sError & "<li>) Gift " & i & ": " & getlang("langCustState") & getlang("langCustRequired") & "<br>"
End If


Below is the full code:


sub ValidateData
'update the array with new data
'verify that required data is entered for each item
for i =1 to scartItem
Dim pcountry
Dim pstate
arrCart(cShippingFirst,i) = trim(Request.Form("strfirstname_"& i) )
If arrCart(cShippingFirst,i) = "" Then
sError = sError & "<li>) Gift " & i & ": <u>" & getlang("langCustFirstname") & "</u>" & getlang("langCustRequired") & "</li><br>"
End If
arrCart(cShippingLast,i) = Trim(Request.Form("strLastname_"& i) )
If arrCart(cShippingLast,i) = "" Then
sError = sError & "<li>) Gift " & i & ": " & getlang("langCustLastname") & getlang("langCustRequired") & "</li><br>"
End If
arrCart(cshipaddress,i) = trim(Request.Form("strAddress_"& i) )
If arrCart(cshipaddress,i) = "" Then
sError = sError & "<li>) Gift " & i & ": " & getlang("langCustAddress") & getlang("langCustRequired") & "</li><br>"
End If
arrCart(cshiptown,i) = trim(Request.Form("strCity_"& i) )
If arrCart(cshiptown,i) = "" Then
sError = sError & "<li>) Gift " & i & ": " & getlang("langCustCity") & getlang("langCustRequired") & "</li><br>"
End If
arrCart(cshipstate,i) = Request.Form("strState_"& i)
If arrCart(cshipstate,i) = "" or arrCart(cshipstate,i)="----- CANADA ----" Then
sError = sError & "<li>) Gift " & i & ": " & getlang("langCustState") & getlang("langCustRequired") & "<br>"
End If
arrCart(cshipcountry,i) = Request.Form("strCountry_"& i)
If arrCart(cshipcountry,i)="" or arrCart(cshipcountry,i)="??" then
sError = sError & "<li>) Gift " & i & ": " & getlang("langCustCountry") & getlang("langCustRequired") & "</li><br>"
End If
arrCart(cshipzip,i) = trim(Request.Form("strPostcode_"& i) )
If arrCart(cshipzip,i) = "" and instr("AL,AS,AD,AO,AI,AG,AW,BS,BH,BB,BZ,BJ,BM,BT,BO,BL,BW,BF,BI,KH,CM,CV,KY,CF,TD,CL,CO,CG,CD,CK,CR,CB,DJ,DM,DO,TL,EC,EG,SV,GQ,ER,ET,FJ,GF,PF,GA,GM,GH,GI,GD,GP,GU,GT,GN,GW,GY,HT,HN,HK,IS,IQ,IE,CI,JM,JO,KE,KI,KW,LA,LB,LS,LR,MO,MW,MV,ML,MT,MR,MU,FM,MD,MC,MS,MA,MZ,NA,NP,AN,NC,NI,NE,NG,NF,MP,OM,PW,PA,PG,PY,PE,QA,RO,RT,RW,SS,SP,SM,SN,SC,SL,SB,NT,SW,EU,KN,LC,MB,TB,VC,SR,SZ,SY,TA,TZ,TI,TG,TO,ZZ,TT,TN,TC,TV,UG,UI,AE,VU,VE,VR,VG,WF,WS,YE,ZM,ZW",ucase(arrCart(cshipcountry,i))) = 0 Then
'"US,CA,AR,AU,AT,BE,BR,BG,CL,CN,HR,EE,FI,FR,DE,GR,IN,IS,IE,IL,IT,JP,MX,AN,NO,PL,PT,RO,RU,SK,ES,SE,CH,UA,UK,UY,VE,VN"
sError = sError & "<li>) Gift " & i & ": " & getlang("langCustPostCode") & getlang("langCustRequired") & "</li><br>"
End If
If len(arrCart(cshipzip,i)) <> 5 and ucase(arrCart(cshipcountry,i)) = "US" then
sError = sError & "<li>) Gift " & i & ": " & getlang("langCustPostCode") & " must be 5 numbers" & "</li><br>"
end if
arrCart(cShippingPhone,i) = trim(Request.Form("strPhone_"& i) )
If arrCart(cShippingPhone,i) = "" Then
sError = sError & "<li>) Gift " & i & ": " & getlang("langCustPhone") & getlang("langCustRequired") & "</li><br>"
End If
arrCart(cshipcompany,i) = Request.Form("strCompany_"& i)
arrCart(cshipemail,i) = Request.Form("strEmail_"& i)
arrCart(cshipgreeting,i) = Request.Form("DeliveryComment_"& i)
arrCart(cshipspecialrequest,i) = Request.Form("deliverySignature_"& i)
arrCart(cleavesignature,i) = Request.Form("strLeaveSignature_"& i)
next
SetSessA "CartArray",arrCart
end sub




Wayne
Gift Baskets - Still holding number 1 ranking 7 months strong? Join Here

Edited by - ProductivePC on August 31 2005 04:27:29

Edited by - ProductivePC on September 01 2005 09:05:08

ProductivePC
VP-CART New User

USA
199 Posts

Posted - September 01 2005 :  10:58:26  Show Profile  Visit ProductivePC's Homepage  Reply with Quote


That worked. I added an IF statement above it asking it the country was = to CA or US then go ahead and look at the state. Works like a charm.




Wayne
Gift Baskets - Still holding number 1 ranking 7 months strong? Join Here
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Snitz Forums 2000
0 Item(s)
$0.00