[Skip to main content](#vessel-content)

#   Values of the "value" attribute of the states list in the addresses

##

- **[alin](/forum/user/51267-alin "View alin's Profile")**
- [![alin's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar51267.png)](/forum/user/51267-alin "View alin's Profile") Topic Author
- [ Offline](/forum/user/51267-alin)

Less More

- Posts: 117
- Thank you received: 6
-
-

8 years 9 months ago -  8 years 9 months ago [\#288019](#288019) by [alin](/forum/user/51267-alin "View alin's Profile")  *[Values of the "value" attribute of the states list in the addresses](/forum/27-checkout/893815-values-of-the-value-attribute-of-the-states-list-in-the-addresses#288019 "-- HikaShop version -- : 3.2.2 -- Joomla version -- : 3.8.5 -- PHP version -- : 7.2.0 -- Browser(s) name and version -- : Firefox 58.0.2  Hi!  Tell me, please, are values of the &quot;value&quot; attribute of the states list in the addresses used anywhere in HikaShop?  If these values are not used anywhere, I have a question - did you think about filling these values with something more useful? For example, it would be very useful to indicate there the states codes according to . HikaShop already have these codes and withdraw them will not be very difficult. But then it will be possible to use these codes to third-party developers to improve the user experience, for example, to offer address hints in the selected region.  Please consider the possibility of replacing these values with unified states codes.  P.S. Tell me, please, how can I get the value of the &quot;value&quot; attribute of the currently selected region using jQuery?")* was created by *[alin](/forum/user/51267-alin "View alin's Profile")*

-- HikaShop version -- : 3.2.2
-- Joomla version -- : 3.8.5
-- PHP version -- : 7.2.0
-- Browser(s) name and version -- : Firefox 58.0.2

Hi!

Tell me, please, are values of the "value" attribute of the states list in the addresses used anywhere in HikaShop?

If these values are not used anywhere, I have a question - did you think about filling these values with something more useful? For example, it would be very useful to indicate there the states codes according to [ ](https://en.wikipedia.org/wiki/ISO_3166-2)[ en.wikipedia.org/wiki/ISO\_3166-2ISO](https://en.wikipedia.org/wiki/ISO_3166-2ISO) 3166-2 . HikaShop already have these codes and withdraw them will not be very difficult. But then it will be possible to use these codes to third-party developers to improve the user experience, for example, to offer address hints in the selected region.

Please consider the possibility of replacing these values with unified states codes.

P.S. Tell me, please, how can I get the value of the "value" attribute of the currently selected region using jQuery?

---

Sorry for my English, it's not my native language.

- [ ![Checkout--MozillaFirefox2018-02-1611.49.33.png](/forum/attachment/42646) ](/forum/attachment/42646 "...1611.49.33.png") [ ](/forum/attachment/42646?download=1 "...1611.49.33.png")

Last edit: 8 years 9 months ago by [alin](/forum/user/51267-alin "View alin's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg5MzgxNS12YWx1ZXMtb2YtdGhlLXZhbHVlLWF0dHJpYnV0ZS1vZi10aGUtc3RhdGVzLWxpc3QtaW4tdGhlLWFkZHJlc3Nlcz90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86587
- Thank you received: 14326
-
-

8 years 9 months ago [\#288020](#288020) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Values of the "value" attribute of the states list in the addresses](/forum/27-checkout/893815-values-of-the-value-attribute-of-the-states-list-in-the-addresses#288020 "-- HikaShop version -- : 3.2.2 -- Joomla version -- : 3.8.5 -- PHP version -- : 7.2.0 -- Browser(s) name and version -- : Firefox 58.0.2  Hi!  Tell me, please, are values of the &quot;value&quot; attribute of the states list in the addresses used anywhere in HikaShop?  If these values are not used anywhere, I have a question - did you think about filling these values with something more useful? For example, it would be very useful to indicate there the states codes according to . HikaShop already have these codes and withdraw them will not be very difficult. But then it will be possible to use these codes to third-party developers to improve the user experience, for example, to offer address hints in the selected region.  Please consider the possibility of replacing these values with unified states codes.  P.S. Tell me, please, how can I get the value of the &quot;value&quot; attribute of the currently selected region using jQuery?")*

Hi,

The value you see there is the namekey of the zone. That's what is used in the hikashop_zone_link table to link zones with sub zones.

Changing these values to use the zone 2 letter code won't be simple.
It would require changing the state dropdown handler, of course, but it would also require keeping backward compatibility for the addresses already in the shops, and most importantly, all the payment plugins and shipping plugins made for HikaShop expect the namekey of the zone in the address. Changing that would require modifying all the plugins, which is impossible, or add some conversion layer.

Now, you could do is differently and run an ajax request to get the code of the zone dynamically.

Getting the selected value of a dropdown with jQuery is easy:
jQuery('#ID').value
where ID is the ID of the dropdown select tag.

The following user(s) said Thank You: [alin](/forum/user/51267-alin "View alin's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg5MzgxNS12YWx1ZXMtb2YtdGhlLXZhbHVlLWF0dHJpYnV0ZS1vZi10aGUtc3RhdGVzLWxpc3QtaW4tdGhlLWFkZHJlc3Nlcz90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[alin](/forum/user/51267-alin "View alin's Profile")**
- [![alin's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar51267.png)](/forum/user/51267-alin "View alin's Profile") Topic Author
- [ Offline](/forum/user/51267-alin)

Less More

- Posts: 117
- Thank you received: 6
-
-

8 years 9 months ago -  8 years 9 months ago [\#288167](#288167) by [alin](/forum/user/51267-alin "View alin's Profile")  Replied by *[alin](/forum/user/51267-alin "View alin's Profile")* on topic *[Values of the "value" attribute of the states list in the addresses](/forum/27-checkout/893815-values-of-the-value-attribute-of-the-states-list-in-the-addresses#288167 "-- HikaShop version -- : 3.2.2 -- Joomla version -- : 3.8.5 -- PHP version -- : 7.2.0 -- Browser(s) name and version -- : Firefox 58.0.2  Hi!  Tell me, please, are values of the &quot;value&quot; attribute of the states list in the addresses used anywhere in HikaShop?  If these values are not used anywhere, I have a question - did you think about filling these values with something more useful? For example, it would be very useful to indicate there the states codes according to . HikaShop already have these codes and withdraw them will not be very difficult. But then it will be possible to use these codes to third-party developers to improve the user experience, for example, to offer address hints in the selected region.  Please consider the possibility of replacing these values with unified states codes.  P.S. Tell me, please, how can I get the value of the &quot;value&quot; attribute of the currently selected region using jQuery?")*

Thank you for detailed explanation!

I'm trying to get the current value of the drop-down list (State) using this code:
Code:

&lt;script&gt; $(document).ready(function(){ var currentRegion = ($("#data_address_address_state_chzn").text()); alert(currentRegion); }); &lt;/script&gt;

It works but only when I edit an address in the Customer Account. When I try to edit an address at the checkout page - it doesn't work. Apparently, this is due to the fact that it needs to perform an AJAX request to display the address fields. I tried a lot of ways that I found on the Stack Exchange, but nothing helps.

Is it possible to get the current value of the drop-down list (State) on the checkout page after clicking edit?

---

Sorry for my English, it's not my native language.

- [ ![Myshopaccount-MozillaFirefox2018-02-1914.45.02.png](/forum/attachment/42691) ](/forum/attachment/42691 "...1914.45.02.png") [ ](/forum/attachment/42691?download=1 "...1914.45.02.png")
- [ ![Checkout--MozillaFirefox2018-02-1914.47.30.png](/forum/attachment/42692) ](/forum/attachment/42692 "...1914.47.30.png") [ ](/forum/attachment/42692?download=1 "...1914.47.30.png")
- [ ![Checkout--MozillaFirefox2018-02-1914.46.18.png](/forum/attachment/42693) ](/forum/attachment/42693 "...1914.46.18.png") [ ](/forum/attachment/42693?download=1 "...1914.46.18.png")

Last edit: 8 years 9 months ago by [alin](/forum/user/51267-alin "View alin's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg5MzgxNS12YWx1ZXMtb2YtdGhlLXZhbHVlLWF0dHJpYnV0ZS1vZi10aGUtc3RhdGVzLWxpc3QtaW4tdGhlLWFkZHJlc3Nlcz90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86587
- Thank you received: 14326
-
-

8 years 9 months ago [\#288169](#288169) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Values of the "value" attribute of the states list in the addresses](/forum/27-checkout/893815-values-of-the-value-attribute-of-the-states-list-in-the-addresses#288169 "-- HikaShop version -- : 3.2.2 -- Joomla version -- : 3.8.5 -- PHP version -- : 7.2.0 -- Browser(s) name and version -- : Firefox 58.0.2  Hi!  Tell me, please, are values of the &quot;value&quot; attribute of the states list in the addresses used anywhere in HikaShop?  If these values are not used anywhere, I have a question - did you think about filling these values with something more useful? For example, it would be very useful to indicate there the states codes according to . HikaShop already have these codes and withdraw them will not be very difficult. But then it will be possible to use these codes to third-party developers to improve the user experience, for example, to offer address hints in the selected region.  Please consider the possibility of replacing these values with unified states codes.  P.S. Tell me, please, how can I get the value of the &quot;value&quot; attribute of the currently selected region using jQuery?")*

For the AJAX, you can use: Code:

if(window.Oby){ window.Oby.registerAjax(['checkout.address.updated'], function(params){ // your code }); }

It will act like $(document).ready

The following user(s) said Thank You: [alin](/forum/user/51267-alin "View alin's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg5MzgxNS12YWx1ZXMtb2YtdGhlLXZhbHVlLWF0dHJpYnV0ZS1vZi10aGUtc3RhdGVzLWxpc3QtaW4tdGhlLWFkZHJlc3Nlcz90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[alin](/forum/user/51267-alin "View alin's Profile")**
- [![alin's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar51267.png)](/forum/user/51267-alin "View alin's Profile") Topic Author
- [ Offline](/forum/user/51267-alin)

Less More

- Posts: 117
- Thank you received: 6
-
-

8 years 9 months ago -  8 years 9 months ago [\#288227](#288227) by [alin](/forum/user/51267-alin "View alin's Profile")  Replied by *[alin](/forum/user/51267-alin "View alin's Profile")* on topic *[Values of the "value" attribute of the states list in the addresses](/forum/27-checkout/893815-values-of-the-value-attribute-of-the-states-list-in-the-addresses#288227 "-- HikaShop version -- : 3.2.2 -- Joomla version -- : 3.8.5 -- PHP version -- : 7.2.0 -- Browser(s) name and version -- : Firefox 58.0.2  Hi!  Tell me, please, are values of the &quot;value&quot; attribute of the states list in the addresses used anywhere in HikaShop?  If these values are not used anywhere, I have a question - did you think about filling these values with something more useful? For example, it would be very useful to indicate there the states codes according to . HikaShop already have these codes and withdraw them will not be very difficult. But then it will be possible to use these codes to third-party developers to improve the user experience, for example, to offer address hints in the selected region.  Please consider the possibility of replacing these values with unified states codes.  P.S. Tell me, please, how can I get the value of the &quot;value&quot; attribute of the currently selected region using jQuery?")*

Hi,

I've tried: Code:

&lt;script&gt; if(window.Oby){ window.Oby.registerAjax(['checkout.address.updated'], function(){ var currentRegion = ($("#data_address_address_state_chzn").text()); alert(currentRegion); }); } &lt;/script&gt;

but it shows nothing after clicking edit link at the checkout page, what am I doing wrong?

I'm trying to create code that will allow me to assign a state identifier (ISO code or name) to a variable to use this variable later for comparison in the if else construct. However, there are several cases:
1. The drop-down list of states while changing / adding address in the Customer Area.
2. The drop-down list of states while adding address at the checkout page (if the address was not added earlier).
3. A drop-down list of states at the checkout page (if the address was added earlier) by clicking on the address editing link (AJAX request).

May be you can explain how to do that:

> nicolas wrote: run an ajax request to get the code of the zone dynamically.

to define variable which contains the code of the zone?

---

Sorry for my English, it's not my native language.

Last edit: 8 years 9 months ago by [alin](/forum/user/51267-alin "View alin's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg5MzgxNS12YWx1ZXMtb2YtdGhlLXZhbHVlLWF0dHJpYnV0ZS1vZi10aGUtc3RhdGVzLWxpc3QtaW4tdGhlLWFkZHJlc3Nlcz90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86587
- Thank you received: 14326
-
-

8 years 9 months ago [\#288229](#288229) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Values of the "value" attribute of the states list in the addresses](/forum/27-checkout/893815-values-of-the-value-attribute-of-the-states-list-in-the-addresses#288229 "-- HikaShop version -- : 3.2.2 -- Joomla version -- : 3.8.5 -- PHP version -- : 7.2.0 -- Browser(s) name and version -- : Firefox 58.0.2  Hi!  Tell me, please, are values of the &quot;value&quot; attribute of the states list in the addresses used anywhere in HikaShop?  If these values are not used anywhere, I have a question - did you think about filling these values with something more useful? For example, it would be very useful to indicate there the states codes according to . HikaShop already have these codes and withdraw them will not be very difficult. But then it will be possible to use these codes to third-party developers to improve the user experience, for example, to offer address hints in the selected region.  Please consider the possibility of replacing these values with unified states codes.  P.S. Tell me, please, how can I get the value of the &quot;value&quot; attribute of the currently selected region using jQuery?")*

Hi,

I don't know. Please provide a link with instructions to reproduce so that we can look at it.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg5MzgxNS12YWx1ZXMtb2YtdGhlLXZhbHVlLWF0dHJpYnV0ZS1vZi10aGUtc3RhdGVzLWxpc3QtaW4tdGhlLWFkZHJlc3Nlcz90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[alin](/forum/user/51267-alin "View alin's Profile")**
- [![alin's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar51267.png)](/forum/user/51267-alin "View alin's Profile") Topic Author
- [ Offline](/forum/user/51267-alin)

Less More

- Posts: 117
- Thank you received: 6
-
-

8 years 9 months ago -  8 years 9 months ago [\#288418](#288418) by [alin](/forum/user/51267-alin "View alin's Profile")  Replied by *[alin](/forum/user/51267-alin "View alin's Profile")* on topic *[Values of the "value" attribute of the states list in the addresses](/forum/27-checkout/893815-values-of-the-value-attribute-of-the-states-list-in-the-addresses#288418 "-- HikaShop version -- : 3.2.2 -- Joomla version -- : 3.8.5 -- PHP version -- : 7.2.0 -- Browser(s) name and version -- : Firefox 58.0.2  Hi!  Tell me, please, are values of the &quot;value&quot; attribute of the states list in the addresses used anywhere in HikaShop?  If these values are not used anywhere, I have a question - did you think about filling these values with something more useful? For example, it would be very useful to indicate there the states codes according to . HikaShop already have these codes and withdraw them will not be very difficult. But then it will be possible to use these codes to third-party developers to improve the user experience, for example, to offer address hints in the selected region.  Please consider the possibility of replacing these values with unified states codes.  P.S. Tell me, please, how can I get the value of the &quot;value&quot; attribute of the currently selected region using jQuery?")*

Hi,

I've inserted the following code before the head tag:
Code:

&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"&gt;&lt;/script&gt; &lt;script&gt; if(window.Oby){ window.Oby.registerAjax(['checkout.address.updated'], function(){ var currentRegion = ($("#data_address_address_state_chzn").text()); alert(currentRegion); }); } &lt;/script&gt;

I see it in the source code of the page. But there is no any alert after clicking address edit link icon at the checkout page.

How can I provide link and credentials? How does confidential tag work?

Addition.

After changing **checkout.address.updated** to **checkoutBlockRefresh** alert is showing but doesn't contain any text. Reverted it back.

---

Sorry for my English, it's not my native language.

- [ ![http&#95;&#95;&#95;localhost-test&#95;shop&#95;checkout-MozillaFirefox2018-02-2223.01.34.png](/forum/attachment/42739) ](/forum/attachment/42739 "...2223.01.34.png") [ ](/forum/attachment/42739?download=1 "...2223.01.34.png")
- [ ![Checkout--MozillaFirefox2018-02-2223.03.51.png](/forum/attachment/42740) ](/forum/attachment/42740 "...2223.03.51.png") [ ](/forum/attachment/42740?download=1 "...2223.03.51.png")

Last edit: 8 years 9 months ago by [alin](/forum/user/51267-alin "View alin's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg5MzgxNS12YWx1ZXMtb2YtdGhlLXZhbHVlLWF0dHJpYnV0ZS1vZi10aGUtc3RhdGVzLWxpc3QtaW4tdGhlLWFkZHJlc3Nlcz90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86587
- Thank you received: 14326
-
-

8 years 9 months ago [\#288451](#288451) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Values of the "value" attribute of the states list in the addresses](/forum/27-checkout/893815-values-of-the-value-attribute-of-the-states-list-in-the-addresses#288451 "-- HikaShop version -- : 3.2.2 -- Joomla version -- : 3.8.5 -- PHP version -- : 7.2.0 -- Browser(s) name and version -- : Firefox 58.0.2  Hi!  Tell me, please, are values of the &quot;value&quot; attribute of the states list in the addresses used anywhere in HikaShop?  If these values are not used anywhere, I have a question - did you think about filling these values with something more useful? For example, it would be very useful to indicate there the states codes according to . HikaShop already have these codes and withdraw them will not be very difficult. But then it will be possible to use these codes to third-party developers to improve the user experience, for example, to offer address hints in the selected region.  Please consider the possibility of replacing these values with unified states codes.  P.S. Tell me, please, how can I get the value of the &quot;value&quot; attribute of the currently selected region using jQuery?")*

Hi,

My code was meant to run after the address has been changed, and not when you click on the edit button.
If you want to have javascript code run when you edit the an address, then you can directly add your code in the show_block_address view file, and not in a "$(document).ready(function(){" but directly.
That way, the javascript will run when the address edition is loaded in AJAX.

The following user(s) said Thank You: [alin](/forum/user/51267-alin "View alin's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg5MzgxNS12YWx1ZXMtb2YtdGhlLXZhbHVlLWF0dHJpYnV0ZS1vZi10aGUtc3RhdGVzLWxpc3QtaW4tdGhlLWFkZHJlc3Nlcz90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[alin](/forum/user/51267-alin "View alin's Profile")**
- [![alin's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar51267.png)](/forum/user/51267-alin "View alin's Profile") Topic Author
- [ Offline](/forum/user/51267-alin)

Less More

- Posts: 117
- Thank you received: 6
-
-

8 years 9 months ago -  8 years 9 months ago [\#288465](#288465) by [alin](/forum/user/51267-alin "View alin's Profile")  Replied by *[alin](/forum/user/51267-alin "View alin's Profile")* on topic *[Values of the "value" attribute of the states list in the addresses](/forum/27-checkout/893815-values-of-the-value-attribute-of-the-states-list-in-the-addresses#288465 "-- HikaShop version -- : 3.2.2 -- Joomla version -- : 3.8.5 -- PHP version -- : 7.2.0 -- Browser(s) name and version -- : Firefox 58.0.2  Hi!  Tell me, please, are values of the &quot;value&quot; attribute of the states list in the addresses used anywhere in HikaShop?  If these values are not used anywhere, I have a question - did you think about filling these values with something more useful? For example, it would be very useful to indicate there the states codes according to . HikaShop already have these codes and withdraw them will not be very difficult. But then it will be possible to use these codes to third-party developers to improve the user experience, for example, to offer address hints in the selected region.  Please consider the possibility of replacing these values with unified states codes.  P.S. Tell me, please, how can I get the value of the &quot;value&quot; attribute of the currently selected region using jQuery?")*

> nicolas wrote: directly add your code in the show\_block\_address view file

Thanks! May be it's the best way but needs overriding show_block_address view file and then every time after HikaShop update, I will need to check whether this file has changed. On the one hand, this simplifies the task of implementing the code, on the other hand, it complicates the task of maintaining the file in an up-to-date state.

Maybe you have an example of a plugin that dynamically injects the code into the show_block_address view file or maybe there is a way to use "clean" jQuery for this purpose, without having to override the show_block_address view file?

Addition.

Sorry it's my fault :oops: I made a mistake in the ID of the element. I used ID from the address editing page in Custom Area - **\#data\_address\_address\_state\_chzn** instead **\#data\_address\_1\_1\_address\_state\_chzn**. This code works:

Code:

&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"&gt;&lt;/script&gt; &lt;script&gt; if(window.Oby){ window.Oby.registerAjax(['checkoutBlockRefresh'], function(){ var currentRegion = ($("#data_address_1_1_address_state_chzn").text()); alert(currentRegion); }); } &lt;/script&gt;

---

Sorry for my English, it's not my native language.

Last edit: 8 years 9 months ago by [alin](/forum/user/51267-alin "View alin's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg5MzgxNS12YWx1ZXMtb2YtdGhlLXZhbHVlLWF0dHJpYnV0ZS1vZi10aGUtc3RhdGVzLWxpc3QtaW4tdGhlLWFkZHJlc3Nlcz90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[alin](/forum/user/51267-alin "View alin's Profile")**
- [![alin's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar51267.png)](/forum/user/51267-alin "View alin's Profile") Topic Author
- [ Offline](/forum/user/51267-alin)

Less More

- Posts: 117
- Thank you received: 6
-
-

8 years 9 months ago -  8 years 9 months ago [\#288654](#288654) by [alin](/forum/user/51267-alin "View alin's Profile")  Replied by *[alin](/forum/user/51267-alin "View alin's Profile")* on topic *[Values of the "value" attribute of the states list in the addresses](/forum/27-checkout/893815-values-of-the-value-attribute-of-the-states-list-in-the-addresses#288654 "-- HikaShop version -- : 3.2.2 -- Joomla version -- : 3.8.5 -- PHP version -- : 7.2.0 -- Browser(s) name and version -- : Firefox 58.0.2  Hi!  Tell me, please, are values of the &quot;value&quot; attribute of the states list in the addresses used anywhere in HikaShop?  If these values are not used anywhere, I have a question - did you think about filling these values with something more useful? For example, it would be very useful to indicate there the states codes according to . HikaShop already have these codes and withdraw them will not be very difficult. But then it will be possible to use these codes to third-party developers to improve the user experience, for example, to offer address hints in the selected region.  Please consider the possibility of replacing these values with unified states codes.  P.S. Tell me, please, how can I get the value of the &quot;value&quot; attribute of the currently selected region using jQuery?")*

Hi,

Tell me please is the Chosen library used in some special way in HikaShop? When the Chosen library is disabled and a normal select element is used, the following code displays an alert every time the State changes:
Code:

&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"&gt;&lt;/script&gt; &lt;script&gt; if(window.Oby){ window.Oby.registerAjax(['checkoutBlockRefresh'], function(){ $('#data_address_1_1_address_state').change(function(){ var currentStateSelect = $("#data_address_1_1_address_state option:selected").text(); alert(currentStateSelect); }) }); } &lt;/script&gt;

But when the Chosen library is enabled and is used, the following code displays nothing when the State changes:
Code:

&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"&gt;&lt;/script&gt; &lt;script&gt; if(window.Oby){ window.Oby.registerAjax(['checkoutBlockRefresh'], function(){ $("#data_address_1_1_address_state_chzn").chosen().change(function(){ var currentStateChosen = ($("#data_address_1_1_address_state_chzn").text()); alert(currentStateChosen); }); }); } &lt;/script&gt;

Also I tried in window.Oby.registerAjax(, function():
Code:

$('#data_address_1_1_address_state_chzn').on('change', function() { var currentStateChosen = ($("#data_address_1_1_address_state_chzn").text()); alert(currentStateChosen); });

and
Code:

$('#data_address_1_1_address_state_chzn').change(function(){ var currentStateChosen = $("#data_address_1_1_address_state_chzn option:selected").text(); alert(currentStateChosen); })

and
Code:

$('#data_address_1_1_address_state_chzn').change(function(){ var currentStateChosen = $("#data_address_1_1_address_state_chzn").text(); alert(currentStateChosen); })

Perhaps there is a way to handle the Chosen select change event in HikaShop?

---

Sorry for my English, it's not my native language.

Last edit: 8 years 9 months ago by [alin](/forum/user/51267-alin "View alin's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg5MzgxNS12YWx1ZXMtb2YtdGhlLXZhbHVlLWF0dHJpYnV0ZS1vZi10aGUtc3RhdGVzLWxpc3QtaW4tdGhlLWFkZHJlc3Nlcz90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Jerome](/forum/user/80-jerome "View Jerome's Profile")**
- [![Jerome's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar80.png)](/forum/user/80-jerome "View Jerome's Profile")
- [ Offline](/forum/user/80-jerome)
- HikaShop core developer

Less More

- Posts: 26402
- Thank you received: 4081
-
- [](http://obsi.dev)
-

8 years 9 months ago [\#288660](#288660) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[Values of the "value" attribute of the states list in the addresses](/forum/27-checkout/893815-values-of-the-value-attribute-of-the-states-list-in-the-addresses#288660 "-- HikaShop version -- : 3.2.2 -- Joomla version -- : 3.8.5 -- PHP version -- : 7.2.0 -- Browser(s) name and version -- : Firefox 58.0.2  Hi!  Tell me, please, are values of the &quot;value&quot; attribute of the states list in the addresses used anywhere in HikaShop?  If these values are not used anywhere, I have a question - did you think about filling these values with something more useful? For example, it would be very useful to indicate there the states codes according to . HikaShop already have these codes and withdraw them will not be very difficult. But then it will be possible to use these codes to third-party developers to improve the user experience, for example, to offer address hints in the selected region.  Please consider the possibility of replacing these values with unified states codes.  P.S. Tell me, please, how can I get the value of the &quot;value&quot; attribute of the currently selected region using jQuery?")*

Hello,

Chosen is a JS lib provided by the Joomla core and usually loaded by templates.
Afterwards, there is a setting in HikaShop to force the loading of chosen.
[ www.hikashop.com/support/documentation/5...html#display\_general](https://www.hikashop.com/support/documentation/54-hikashop-config.html#display_general)

If you want to know more about Chosen, I recommend you their website for documentation.
[ harvesthq.github.io/chosen/](https://harvesthq.github.io/chosen/)

Regards,

---

Jerome - Obsidev.com
HikaMarket &amp; HikaSerial developer / HikaShop core dev team.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg5MzgxNS12YWx1ZXMtb2YtdGhlLXZhbHVlLWF0dHJpYnV0ZS1vZi10aGUtc3RhdGVzLWxpc3QtaW4tdGhlLWFkZHJlc3Nlcz90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.133 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
