*

chris

  • **
  • 29 posts
[help] auto selection of a lonely country
« on: December 08, 2020, 11:04:27 AM »
hi,

i have only one country on my website : France (and it will stay like this)

i want location input shown as a dropdown list

i want users can access the item-post.php file even if they are not logged in (or if they are but they have not selected a city as user)

There is a little problem in that case, because :

as there is only one country, country choice does not appear in item-post.php but the country is not pre selected so you can't select a region, and neither a city.

i would like that the country be auto selected. That way, when user want to add his listing, he should directly select a region which is under the country (France in my case, PK_C_CODE = "FR")

Thanks for your time guys !


Marked as best answer by frosticek on December 09, 2020, 11:17:37 AM
*

MB Themes

Re: [help] auto selection of a lonely country
« Reply #1 on: December 08, 2020, 03:31:31 PM »
@chris
If you add following code to your item-post.php, it could work.
Code: [Select]
<script>
$(document).ready(function() {
  $('select[name="countryId"]').val($('select[name="countryId"] option:last').val());
  $('select[name="countryId"]').change();
});
</script>

or

Code: [Select]
<script>
$(document).ready(function() {
  $('select[name="countryId"]').prop("selectedIndex", 1);
  $('select[name="countryId"]').change();
});
</script>
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

chris

  • **
  • 29 posts
Re: [help] auto selection of a lonely country
« Reply #2 on: December 09, 2020, 11:02:46 AM »
thank you very much. i will buy you 2 or 3 plugins

*

MB Themes

Re: [help] auto selection of a lonely country
« Reply #3 on: December 09, 2020, 11:17:54 AM »
@chris
Or 23  8)
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

chris

  • **
  • 29 posts
Re: [help] auto selection of a lonely country
« Reply #4 on: January 14, 2021, 09:19:09 AM »
i've bought 3, as you can notice, but waiting for some answers on other topics to buy more  :)

*

MB Themes

Re: [help] auto selection of a lonely country
« Reply #5 on: January 14, 2021, 12:43:11 PM »
@chris
Approved.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots