the symfony form is,
'nation' =>new sfWidgetFormChoice(array('choices' => NationPeer::getAllNation())),
'township' =>new sfWidgetFormChoice(array('choices' => TownshipPeer::getAllTownship())),
On selecting the nation (like India) it should populate township(with the township within India). I Dont want to use Javascripts!
views:
403answers:
2If I understand it correctly you want to change the second sfWidgetFormChoice depending on the selection of the first sfWidgetFormChoice. On the loading of the page you can prerender the current selected value for the second form already, but when you change the value of the first form you want to change the value of the second form too, right?
I'm sorry, but one way or another, you must depend on Javascript for this. With Symfony you can use the AJAX helpers to solve this problem and not be bothered by writing to many Javascript by yourself. You can use the 'observe_field' function to change the second Form to your new value. The trick is to rerender the second Widget with a different value every time.
See this page for more information: http://www.symfony-project.org/book/1%5F2/11-Ajax-Integration#chapter%5F11%5Fsub%5Fajax%5Fdriven%5Fforms
Unfortunately a web page cannot react to a client action unless JavaScript is used.