tags:

views:

403

answers:

2

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!

A: 

If 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

TheGrandWazoo
+1  A: 

Unfortunately a web page cannot react to a client action unless JavaScript is used.

Jon Winstanley
in ASP.NET we can do like that by turning on the property of the server control autopostback="true" (by default its false for textbox).same way we can do it for dropdown(select/combobox), without javascripts. when ever there is a change in selection it will fire the event that is set. (might be possible in PARADO, i dont know..never used it)
Harish Kurup
Autopostback is JavaScript too. The only way to do it without JavaScript would be to split it into 2 forms, submit the first to get answers for the 2nd.
Jon Winstanley
but ASP.NET is giving a inbuilt autopostback event, and if we make two forms, it will be a rework and there will be multiple selections like that. any way thats a good idea if there is noway at all(if Javascripts is banned by UN). Thanks Jon Winstanley!
Harish Kurup
Have you tried autopostback with JavaScript turned off? I think you'll find that ASP.NET injects JavaScript into your page.
Jon Winstanley