mercredi 1 avril 2015

keep selected parameter (values) of search form symfony2

i made search form in my symfony2 application.but when i submit the form selected values not preserve on next render


i know i can achieve this through selected= "selected"


but how can i give that condition of GET variable because twig not supported php code in it


my code for sample like



<form action="{{ path('dcampaign') }}" method="get" class="doctor">

<select placeholder="Select Chronic Diseases" class="SlectBox" multiple="multiple" name="symptomlist[]" >

{% for symptoms in symptoms_array %}

<option value = {{symptoms.id}} >{{ symptoms.name}}</option>
{% endfor %}
</select>
<input type="submit" value="Create Campaign" class="btn btn-info" id="searchBtn" >
</form>


i tried app.request.query.get(); but doesn't help much...

Aucun commentaire:

Enregistrer un commentaire