CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Required Field - State is a required field - State / Country Selector
Pages: [1]

Author Topic: Required Field - State is a required field - State / Country Selector  (Read 2327 times)

yogibear

  • I post occasionally
  • **
  • Posts: 66
  • Karma: 0
    • Byron Yoga
  • CiviCRM version: 4.1
  • CMS version: 6.2
  • MySQL version: 5.0
  • PHP version: 5.2
Required Field - State is a required field - State / Country Selector
August 04, 2009, 11:41:51 am
(I searched this forum and Google before asking this, so I'm sorry if it is elementary :))

I would like to make State a required field in signup profiles but get an issue with country's that don't have a state (eg American Samoa), message returned is:

Please correct the following errors in the form fields below:
State is a required field.

Is there a way to have state required and pass validation for country's that don't have one?

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Required Field - State is a required field - State / Country Selector
August 04, 2009, 12:49:44 pm

i'm assuming u mean profile validation?

the "required" validation is done by the framework, so would be hard to circumvent. You can make it optional in the profile, and use the validation hook to check that states are specified for countries that have them. note that u will need php, mysql and drupal knowledge to do this

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: Required Field - State is a required field - State / Country Selector
August 04, 2009, 01:14:59 pm
would another option be to add a 'not applicable' option to the various state tables?
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

yogibear

  • I post occasionally
  • **
  • Posts: 66
  • Karma: 0
    • Byron Yoga
  • CiviCRM version: 4.1
  • CMS version: 6.2
  • MySQL version: 5.0
  • PHP version: 5.2
Re: Required Field - State is a required field - State / Country Selector
August 04, 2009, 01:23:17 pm
Bwilliant, love the tricky ways hard things can be done sometimes :)

rjlang

  • I post occasionally
  • **
  • Posts: 48
  • Karma: 1
  • CiviCRM version: 4.2.8
  • CMS version: Drupal 6
  • MySQL version: 5.0.77
  • PHP version: 5.3.19
Re: Required Field - State is a required field - State / Country Selector
December 20, 2009, 12:38:35 pm
Hi,
I just ran into this issue myself. We're putting on an event in Singapore, which has no states defined, so that the State/Province popup menu in the billing block is empty. But the CiviEvent registration form complains that there's no state selection if one tries to proceed. The fix that I found, which seems to work, is to edit the file

civicrm/CRM/Core/Payment/Form.php

and change the 'is_required' field of the state/province menu from true to false. So this field is no longer required, and it appears that credit cards will still verify if this field is left blank but all the other forms are correct.

This seems to fix the immediate problem. If anyone knows of some hidden bad side effect, say something (and if I discover one, I'll post a follow-up here).

Robert

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Required Field - State is a required field - State / Country Selector

This forum was archived on 2017-11-26.