Home › Forums › Calendar Products › Community Events › Problem with Country dropdown in ‘Add Event’
- This topic has 6 replies, 3 voices, and was last updated 10 years, 10 months ago by
Leah.
-
AuthorPosts
-
October 7, 2014 at 12:39 pm #794660
Tran
ParticipantAttempting to use jQuery to make a separate drop down menu disappear, depending on whether or not the user selects Canada or United States in the Country drop down menu.
The province drop down (for canada) is wrapped in a div titled provincediv
Code is below:
$(“#provincediv”).show();
//Show the text field only when the third option is chosen – this doesn’t
$(‘#EventCountry’).change(function() {
if ($(“#EventCountry”).val() == “1”) {
$(“#provincediv”).hide();
}
else {
$(“#provincediv”).show();
}
});Unsure of what the value should be when trying to sync with the $countries array (in tribe-view-helpers.class.php) — Ive tried “United States”, I’ve tried “US”, and I’ve tried both “1” and “2” the number of lines it is down from the first array number. How can I properly connect this?
Example: User clicks United States… the loadStates() is loaded as per usual, and the div provincediv is hidden. Is user clicks Canada, the provincediv is shown, and the loadStates() is hidden (as per usual)
Thanks.
October 7, 2014 at 1:06 pm #794707Tran
ParticipantI think perhaps its something to do with maybe the array in events calendar are set up as a key, im not sure how to fetch the key in the way I want to fetch it…
October 8, 2014 at 6:50 am #796381Barry
MemberHi Tran,
So just to clarify: is the problem that when you/a customer selects Canada (or any country other than the United States) you wish the list of US states to disappear?
If so, I just want to clarify that this is actually a bug – it should disappear automatically – and it’s a bug we’ve already logged as being in need of a fix. With that in mind, is it possible you could wait on the official fix for this?
October 8, 2014 at 7:00 am #796425Tran
ParticipantThanks for response. No, Id like for the canadian provinces dropdown to disppear when the united states is selected from the country list.
The only way I can get it functioning the way I’d like it too, is to modify the StateProvinceText field that appears when you select Canada into being a dropdown select field. However it loses its CSS. Styling and the search feature – so it doesnt work correctly…
What I did was create a completely new dropdown menu for provinces (copying the same code and loadStates() as the united states drop down has, and now Im trying to just hide this new dropdown whenever any other country aside from ‘Canada’ is selected.
October 8, 2014 at 10:20 am #796773Barry
MemberAhh, I see.
So we can’t provide too much help with customizations like this one (a dropdown field for Canadian provinces is not after all something our plugin generates by itself) but perhaps instead of trying to compare against a numeric value/string containing a number as you are currently doing you could just compare against a string representing the name of the country?
jQuery("#EventCountry").val(); // returns "United States", etc, rather than "1" or "2"Does that help?
October 22, 2014 at 7:50 am #827010Barry
MemberHi! It’s been a while so I’m going to go ahead and close this thread (and so it will no longer be monitored by staff). If we can help with anything else, though, please don’t hesitate to create new threads as needed. Thanks!
June 2, 2015 at 3:23 pm #966767Leah
MemberHi there,
Thank you for your support and patience while we worked on this issue. We are happy announce that we have incorporated a fix into our upcoming 3.10 release. Keep an eye out for a release announcement on our site and for updates available on your WordPress dashboard.
While we have thoroughly tested this release and are confident of its quality, it is impossible to account for every edge case in the wide world of WordPress. If you run into trouble with the new version or you don’t see your reported issue corrected, please start a new thread and we will be happy to work with you.
Thanks again for your patience here. We’re excited to get this version out the door and into your hands!
Best,
The Events Calendar Team -
AuthorPosts
- The topic ‘Problem with Country dropdown in ‘Add Event’’ is closed to new replies.
