Setting a default for the state.

  • Mike Holmes
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
11 years 5 months ago #51685 by Mike Holmes
Setting a default for the state. was created by Mike Holmes
Is it possible to set the state to default in event booking? Almost all of the users of the site will live in the same city, stat, zip code so having these default to the correct values would be very helpful. At this point everything works but the state.
Mike

Please Log in or Create an account to join the conversation.

  • Tuan Pham Ngoc
  • Away
  • Administrator
  • Administrator
More
11 years 5 months ago #51707 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Setting a default for the state.
Hi Mike

At the moment, it is not possible. Since this is not a minor issue, I will work on it to support it next week. This week I am really busy

Regards,

Tuan
The following user(s) said Thank You: Mike Holmes

Please Log in or Create an account to join the conversation.

  • Mike Holmes
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
11 years 3 months ago #54451 by Mike Holmes
Replied by Mike Holmes on topic Setting a default for the state.
Tuan,
Did you get a chance to look at this?
Mike

Please Log in or Create an account to join the conversation.

  • Tuan Pham Ngoc
  • Away
  • Administrator
  • Administrator
More
11 years 3 months ago #54469 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Setting a default for the state.
Hi Mike

Please submit a support ticket sending us super admin account of your site so that I can edit the code for you to have the state select by default.

I will think more about it before making it as a standard feature in the extension later.

Regards,

Tuan

Please Log in or Create an account to join the conversation.

More
11 years 2 months ago - 11 years 2 months ago #56466 by Jean-Francois
Replied by Jean-Francois on topic Setting a default for the state.
Hi,

I have the same problem as Mike... All the members of my client are all in the same "state". It does not seem possible to configure a "default state" in the "costum field". I'm using the 1.6.8 version of Pro Membership.

Can you do something about it?

Jean-Francois Gagnon
Last edit: 11 years 2 months ago by Jean-Francois.

Please Log in or Create an account to join the conversation.

More
11 years 2 months ago #56468 by James Riley
Replied by James Riley on topic Setting a default for the state.
I was just looking for this option yesterday, and wondering if it was possible seeing as the option exists to select a default country. Please add my support behind the request!

James Riley .: EventBooking user since 2014 ::: JoomDonation user since 2016 :.
.: grfx & web design / IT / AV @ St. Therese Institute of Faith and Mission, Bruno, SK, Canada :.

Please Log in or Create an account to join the conversation.

More
11 years 2 months ago - 11 years 2 months ago #56472 by James Riley
Replied by James Riley on topic Setting a default for the state.
[EDIT Jan 27 2015] -- USE TUAN's SOLUTION IN THE NEXT POST!!! No need to do custom coding/scripting!
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Here's how I'm doing it right now for individual registration (kind of a ad hoc, bandage solution, but it works).
Long story short, I have a custom Javascript running (via a module) that loads whenever Event Booking is running. I probably wouldn't have to run the test for State = unselected (document.getElementById("state").selectedIndex==0) and Country = Canada (document.getElementById("country").value=='Canada'), but I am. Why? Just because I'm paranoid :)

To implement on your site, get the JS running however you want (template include, hard-coded into EventBooking, custom html module that permits javascript (I'm using an addon called Custom HTML Advanced) , etc), change "Canada" to your country, and change selectedIndex = 12 to whatever state you want in your list (count down the state list; the 'Select State' option is selectedIndex=0).

Code:
<script type="text/javascript"> window.onload = function(){ if ((String(window.location.href)).search('task=individual_registration')!=-1) { if((document.getElementById("state").selectedIndex==0)&&(document.getElementById("country").value=='Canada')) { document.getElementById('state').selectedIndex = 12; } } } </script>

I tried looking through the php code for a quick way to default the "state" to what I wanted, but couldn't make it work easily. Doing it this way means that it is one less change that I have to maintain when the next version of Event Booking releases, too. It'll work as long as the user is running javascript, and if they are not, then they'll just have to -- ACK! -- pick the state themselves.

James Riley .: EventBooking user since 2014 ::: JoomDonation user since 2016 :.
.: grfx & web design / IT / AV @ St. Therese Institute of Faith and Mission, Bruno, SK, Canada :.
Last edit: 11 years 2 months ago by James Riley. Reason: added recommendation to follow Tuan's instruction in next post.

Please Log in or Create an account to join the conversation.

  • Tuan Pham Ngoc
  • Away
  • Administrator
  • Administrator
More
11 years 2 months ago #56630 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Setting a default for the state.
Hi

The solution is editing the State custom field, set Default Values for the states

Please note that in the latest version, the extension use state full name. So in the default value, instead of writing IL (the state code), you need to write Illinois (the state name)

Regards,

Tuan
The following user(s) said Thank You: James Riley

Please Log in or Create an account to join the conversation.

More
11 years 2 months ago #56846 by James Riley
Replied by James Riley on topic Setting a default for the state.
What a simple solution, Tuan. So much easier than forcing it with external scripting like I was doing.

James Riley .: EventBooking user since 2014 ::: JoomDonation user since 2016 :.
.: grfx & web design / IT / AV @ St. Therese Institute of Faith and Mission, Bruno, SK, Canada :.

Please Log in or Create an account to join the conversation.

  • Tuan Pham Ngoc
  • Away
  • Administrator
  • Administrator
More
11 years 2 months ago #56851 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Setting a default for the state.
Yes James. Why needs an extra script while the extension support it already :).

Please Log in or Create an account to join the conversation.

Moderators: Tuan Pham Ngoc