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

#   zone field not validating for blank

##

- **[wildfire](/forum/user/4403-wildfire "View wildfire's Profile")**
- [![wildfire's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar4403.jpg)](/forum/user/4403-wildfire "View wildfire's Profile") Topic Author
- [ Offline](/forum/user/4403-wildfire)
- eCommerce Maven

Less More

- Posts: 60
- Thank you received: 9
-
-
-
- [](http://www.davekarlsven.com)
-

14 years 3 months ago [\#57660](#57660) by [wildfire](/forum/user/4403-wildfire "View wildfire's Profile")  *[zone field not validating for blank](/forum/3-bug-report/57660-zone-field-not-validating-for-blank#57660 "We were having an issue with the &quot;Zone&quot; field not being selected properly by the customer.  For example we had a default Country of the United States and therefore a default state/zone of &quot;Alabama&quot;, however customers continually were not changing the selection of the zone and so their address would say that they were in Alabama.  So we created a blank zone name and set that to default, so that people would select their proper state in the address field.  However now, we get a lot of customers not filling in anything for the state and even though the field is marked as Required, it still lets a blank value come through.  Is there any way to make it so the form will validate the state field to make it so a blank value doesn't come through if the customer forgets to change their zone/state to the correct one on the form?")* was created by *[wildfire](/forum/user/4403-wildfire "View wildfire's Profile")*

We were having an issue with the "Zone" field not being selected properly by the customer.

For example we had a default Country of the United States and therefore a default state/zone of "Alabama", however customers continually were not changing the selection of the zone and so their address would say that they were in Alabama.

So we created a blank zone name and set that to default, so that people would select their proper state in the address field.

However now, we get a lot of customers not filling in anything for the state and even though the field is marked as Required, it still lets a blank value come through.

Is there any way to make it so the form will validate the state field to make it so a blank value doesn't come through if the customer forgets to change their zone/state to the correct one on the form?

---

Ecommerce expert for hire. [ DaveKarlsven.com](http://www.davekarlsven.com)

I love helping businesses make lots of money online.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMtYnVnLXJlcG9ydC81NzY2MC16b25lLWZpZWxkLW5vdC12YWxpZGF0aW5nLWZvci1ibGFuaz90bXBsPW1hcmtkb3du) 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: 86541
- Thank you received: 14304
-
-

14 years 3 months ago [\#57725](#57725) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Re: zone field not validating for blank](/forum/3-bug-report/57660-zone-field-not-validating-for-blank#57725 "We were having an issue with the &quot;Zone&quot; field not being selected properly by the customer.  For example we had a default Country of the United States and therefore a default state/zone of &quot;Alabama&quot;, however customers continually were not changing the selection of the zone and so their address would say that they were in Alabama.  So we created a blank zone name and set that to default, so that people would select their proper state in the address field.  However now, we get a lot of customers not filling in anything for the state and even though the field is marked as Required, it still lets a blank value come through.  Is there any way to make it so the form will validate the state field to make it so a blank value doesn't come through if the customer forgets to change their zone/state to the correct one on the form?")*

You need to go in the database and change the namekey of that blank zone to be empty.
You will have to change that in two places:
in the zone_namekey field of the table hikashop_zone and in the zone_child_namekey of the table hikashop_zone_link

Once that's done, set it as the default value in the custom field (you need to save the custom field's options) and make sure that the required option of the custom field is turned on.

That way, I think it will display an error message when the state field is empty.

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

- **[wildfire](/forum/user/4403-wildfire "View wildfire's Profile")**
- [![wildfire's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar4403.jpg)](/forum/user/4403-wildfire "View wildfire's Profile") Topic Author
- [ Offline](/forum/user/4403-wildfire)
- eCommerce Maven

Less More

- Posts: 60
- Thank you received: 9
-
-
-
- [](http://www.davekarlsven.com)
-

14 years 3 months ago [\#57852](#57852) by [wildfire](/forum/user/4403-wildfire "View wildfire's Profile")  Replied by *[wildfire](/forum/user/4403-wildfire "View wildfire's Profile")* on topic *[Re: zone field not validating for blank](/forum/3-bug-report/57660-zone-field-not-validating-for-blank#57852 "We were having an issue with the &quot;Zone&quot; field not being selected properly by the customer.  For example we had a default Country of the United States and therefore a default state/zone of &quot;Alabama&quot;, however customers continually were not changing the selection of the zone and so their address would say that they were in Alabama.  So we created a blank zone name and set that to default, so that people would select their proper state in the address field.  However now, we get a lot of customers not filling in anything for the state and even though the field is marked as Required, it still lets a blank value come through.  Is there any way to make it so the form will validate the state field to make it so a blank value doesn't come through if the customer forgets to change their zone/state to the correct one on the form?")*

Nicolas,

I have gone through and removed the namekey from the database fields you have specified and made sure to save the custom field with the default the blank one and the field is marked as required,

However it is still not validating the field as empty and lets me progress to the next step in the checkout without a state/zone selected.

Is there anything else you can think of that needs to be added or changed so that the State/Zone field will need to be selected (required to have a value entered to checkout) ?

---

Ecommerce expert for hire. [ DaveKarlsven.com](http://www.davekarlsven.com)

I love helping businesses make lots of money online.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMtYnVnLXJlcG9ydC81NzY2MC16b25lLWZpZWxkLW5vdC12YWxpZGF0aW5nLWZvci1ibGFuaz90bXBsPW1hcmtkb3du) 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: 86541
- Thank you received: 14304
-
-

14 years 3 months ago [\#58029](#58029) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Re: zone field not validating for blank](/forum/3-bug-report/57660-zone-field-not-validating-for-blank#58029 "We were having an issue with the &quot;Zone&quot; field not being selected properly by the customer.  For example we had a default Country of the United States and therefore a default state/zone of &quot;Alabama&quot;, however customers continually were not changing the selection of the zone and so their address would say that they were in Alabama.  So we created a blank zone name and set that to default, so that people would select their proper state in the address field.  However now, we get a lot of customers not filling in anything for the state and even though the field is marked as Required, it still lets a blank value come through.  Is there any way to make it so the form will validate the state field to make it so a blank value doesn't come through if the customer forgets to change their zone/state to the correct one on the form?")*

Ah, I know. You will have to also remove the code:
function JSCheck(&amp;$oneField,&amp;$requiredFields,&amp;$validMessages,&amp;$values){

}

in the file administrator/components/com_hikashop/classes/field.php

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

- **[wildfire](/forum/user/4403-wildfire "View wildfire's Profile")**
- [![wildfire's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar4403.jpg)](/forum/user/4403-wildfire "View wildfire's Profile") Topic Author
- [ Offline](/forum/user/4403-wildfire)
- eCommerce Maven

Less More

- Posts: 60
- Thank you received: 9
-
-
-
- [](http://www.davekarlsven.com)
-

14 years 3 months ago [\#58120](#58120) by [wildfire](/forum/user/4403-wildfire "View wildfire's Profile")  Replied by *[wildfire](/forum/user/4403-wildfire "View wildfire's Profile")* on topic *[Re: zone field not validating for blank](/forum/3-bug-report/57660-zone-field-not-validating-for-blank#58120 "We were having an issue with the &quot;Zone&quot; field not being selected properly by the customer.  For example we had a default Country of the United States and therefore a default state/zone of &quot;Alabama&quot;, however customers continually were not changing the selection of the zone and so their address would say that they were in Alabama.  So we created a blank zone name and set that to default, so that people would select their proper state in the address field.  However now, we get a lot of customers not filling in anything for the state and even though the field is marked as Required, it still lets a blank value come through.  Is there any way to make it so the form will validate the state field to make it so a blank value doesn't come through if the customer forgets to change their zone/state to the correct one on the form?")*

Great, that seemed to do the trick.

Thanks for your help, Nicolas.

I would suggest you think about adding a "--Select--" option as the first option on the drop down lists if a Default option is not set, that is required to be changed so that users don't accidently submit the form without changing their Zone or other options in the drop down lists to their proper ones.

We had several users checkout with the wrong address because for some reason they did not take the time to change the State they lived in from the default State.

The code changes you sent us work great, but we always hate hacking the code because it will be more things to keep track of and change when you come out with new updates.

Thanks for the great software and great support you provide.

---

Ecommerce expert for hire. [ DaveKarlsven.com](http://www.davekarlsven.com)

I love helping businesses make lots of money online.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMtYnVnLXJlcG9ydC81NzY2MC16b25lLWZpZWxkLW5vdC12YWxpZGF0aW5nLWZvci1ibGFuaz90bXBsPW1hcmtkb3du) 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: 86541
- Thank you received: 14304
-
-

14 years 3 months ago [\#58152](#58152) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Re: zone field not validating for blank](/forum/3-bug-report/57660-zone-field-not-validating-for-blank#58152 "We were having an issue with the &quot;Zone&quot; field not being selected properly by the customer.  For example we had a default Country of the United States and therefore a default state/zone of &quot;Alabama&quot;, however customers continually were not changing the selection of the zone and so their address would say that they were in Alabama.  So we created a blank zone name and set that to default, so that people would select their proper state in the address field.  However now, we get a lot of customers not filling in anything for the state and even though the field is marked as Required, it still lets a blank value come through.  Is there any way to make it so the form will validate the state field to make it so a blank value doesn't come through if the customer forgets to change their zone/state to the correct one on the form?")*

We'll add that to the todo list.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMtYnVnLXJlcG9ydC81NzY2MC16b25lLWZpZWxkLW5vdC12YWxpZGF0aW5nLWZvci1ibGFuaz90bXBsPW1hcmtkb3du) 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.057 seconds

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