mark: A photo of Mark kneeling on top of the Taal Volcano in the Philippines. It was a long hike. (Default)
Mark Smith ([staff profile] mark) wrote in [site community profile] changelog2010-04-18 09:48 pm

[dw-free] make 'state' a non-required field for non-US/non-Canada countries

[commit: http://hg.dwscoalition.org/dw-free/rev/108599c7bc5f]

http://bugs.dwscoalition.org/show_bug.cgi?id=2530

Don't require states for non-US/CA orders. Some countries don't have states
or provinces.

Patch by [staff profile] mark.

Files modified:
  • htdocs/shop/entercc.bml
--------------------------------------------------------------------------------
diff -r e0b133ed81ff -r 108599c7bc5f htdocs/shop/entercc.bml
--- a/htdocs/shop/entercc.bml	Wed Apr 14 16:42:56 2010 -0500
+++ b/htdocs/shop/entercc.bml	Sun Apr 18 21:48:12 2010 +0000
@@ -157,9 +157,8 @@ body<=
 
     # if US, then US state must be selected
     $err{state} = $ML{'.error.required'}
-        if $in{country} eq 'US' && $POST{usstate} !~ /^\w\w$/;
-    $err{state} = $ML{'.error.required'}
-        if $in{country} ne 'US' && $POST{otherstate} !~ /\S/;
+        if ( $in{country} eq 'US' && $POST{usstate} !~ /^\w\w$/ ) ||
+           ( $in{country} eq 'CA' && $POST{otherstate} !~ /\S/ );
 
     # if there are any errors in fields (some required but not given) then
     # we return to handle the form now
--------------------------------------------------------------------------------

Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org