Re: Re: State/Zone field is required when Not applicable.

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15422
Re: Re: State/Zone field is required when Not applicable.

Disabling it is really just a design decision so that customers don't see the N/A message and still click on it. I decided instead to just trick the forms API during the validation process to make that field not required for validation purposes, and it appears to work great. I added these lines after line 242 and the corresponding bit for the billing pane:

<?php
 
if (isset($_POST['panes']) && count($contents['delivery_zone']['#options']) == 1) {
   
$contents['delivery_zone']['#required'] = FALSE;
  }
?>
State/Zone field is required when Not applicable. By: ricecooker (28 replies) Fri, 01/04/2008 - 02:55