One field's value as a part of another field

Iman Emran asked on May 31, 2017 21:07

Hi,

I customized Ecommerce.Address Module and added two new fields: AddressProvinceID and AddressCityID.

Form control for Both of them are Dropdownlist and AddressCityID depends on AddressProvinceID and Dropdownlist of AddressCityID fills with data accourding to selected AddressProvinceID.

SQL query for AddressProvinceID data source is: SELECT -1 as ProvinceID, '(Select)' as ProvinceDisplayName UNION SELECT ProvinceID, ProvinceDisplayName FROM CustomTable_Province

and SQL query for AddressCityID data source is: SELECT -1 as CityID, '(Select)' as CityDisplayName UNION SELECT CityID, CityDisplayName FROM CustomTable_City INNER JOIN CustomTable_Province ON CustomTable_City.CityProvinceID = CustomTable_Province.ProvinceID WHERE CustomTable_City.CityProvinceID = {% AddressProvinceID %}

The problem is when I set both of them in checkout process and go to the next step the value of AddressCityID not saving.

Also when I debug the macro, {% AddressProvinceID %} returns two times, -1 for first time and then returns correct value of selected AddressProvinceID.

Recent Answers


Zach Perry answered on June 1, 2017 00:05

Have you tried AddressProvinceID.Value?

1 votesVote for this answer Mark as a Correct answer

Iman Emran answered on June 1, 2017 01:29 (last edited on December 10, 2019 02:30)

Hi Zachary, AddressProvinceID.Value not work on Data source SQL query. I tested {%Form.GetValue("AddressProvinceID")|(identity)GlobalAdministrator%} get same result and not working.

Please help me to solve this issue.

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on June 10, 2017 18:48

I believe what you need to do is ensure the field you need to get the value from does a post back so the value is set before submission. So in the field you are getting the value from, set has depending forlds (which should cause a post back) and hopefully fix the issue.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.