2

I have two select box field in my grid form. one is country and other one is states list. I have two countries(Us and Canada). based on the country input selection i have to change the options value in state list input.

How can i perform this task in magento adminhtml grid form side?. Please advice me on this.

enter image description here

2

What you are talking about is actually the RegionUpdater. It is a Javascript class loaded in every page by default (frontend as backend). For the adminhtml, you can find it in this file : (look for RegionUpdater, I have it on line 185)

/js/mage/adminhtml/form.js

You can use it on your grid by adding a select element to your grid, and calling the RegionUpdater class with the good id of the elements. (You will need the country select element, the state text element, the state select element, as well as the data of the regions)

You can find an example of how it is used in the backend in this file : (the function render will interest you)

/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Renderer/Region.php

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.