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) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Jquery/JS to capture country field selection
Pages: [1]

Author Topic: Jquery/JS to capture country field selection  (Read 343 times)

idmacdonald

  • I post occasionally
  • **
  • Posts: 69
  • Karma: 1
Jquery/JS to capture country field selection
July 22, 2015, 08:16:29 am
Hi,

I have developed a site for a client that uses a profile to capture address and contact information for event registrations using CiviEvent. One of the fields on the registration form is a 'Country' field. There is a requirement from the client to fill in another form field with a default value based upon the Country selected. I have done similar things with jQuery in relation to other fields on the form, but the country field widget is quite complicated and I can't quite figure out how to target the user's selecting a country and get the country value with jQuery. I am sure there must be some code in CiviCRM that does this, in order to display the correct set of state/province fields based upon the country selection. But I have not been able to locate such code. Can anyone give me any pointers in terms of where I can find the CiviCRM code that does this, or sample JS/jQuery code that will detect the country field selection on a profile form?

Edit: This is on CiviCRM 4.6.2.

Many thanks,
-Ian

Coleman Watts

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 2346
  • Karma: 183
  • CiviCRM version: The Bleeding Edge
  • CMS version: Various
Re: Jquery/JS to capture country field selection
July 22, 2015, 08:41:37 am
This would be a good question to ask in http://civicrm.stackexchange.com/
Try asking your question on the new CiviCRM help site.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Jquery/JS to capture country field selection

This forum was archived on 2017-11-26.