1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
| <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
window.onload = function()
{
ajoutOptionVide('hotels_gestionannoncesbundle_provincetype_departement');
ajoutOptionVide('hotels_gestionannoncesbundle_provincetype_pays');
};
function ajoutOptionVide(idElem)
{
document.getElementById(idElem).options[0] = new Option('', 0, true, true);
}
function majPays(idSelect, idDepartement)
{
var DATA = "idDepartement="+idDepartement;
$.ajax
({
type: "POST",
url: "{{ path('province_paysByDepartement') }}",
data: DATA,
success: function(res)
{
var tabRes = res.split('+');
document.getElementById(idSelect).options.length = 0;
document.getElementById(idSelect).options[0] = new Option(tabRes[1], tabRes[0], true, false)
}
});
return (false);
}
function majDepartements(idSelect, idPays)
{
var DATA = "idPays="+idPays;
$.ajax
({
type: "POST",
url: "{{ path('province_departementsByPays') }}",
data: DATA,
success: function(res)
{
var tabRes = res.split('+');
document.getElementById(idSelect).options.length = 0;
document.getElementById(idSelect).options[0] = new Option('', 0, true, false);
var tabDep;
for(i = 0; i < tabRes.length; i++)
{
tabDep = tabRes[i].split('_');
document.getElementById(idSelect).options[i + 1] = new Option(tabDep[1], tabDep[0]);
}
}
});
return (false);
}
</script>
<h1>Province creation</h1>
<form action="{{ path('province_create') }}" method="post" {{ form_enctype(form) }}>
<div class="error">
{{ form_errors(form) }}
</div>
<table>
<tr>
<th>{{ form_label(form.nom) }}</th>
<th>{{ form_label(form.departement) }}</th>
<th>{{ form_label(form.pays) }}</th>
</tr>
<tr>
<td>
{{ form_errors(form.nom) }}
{{ form_widget(form.nom) }}
</td>
<td>
{{ form_errors(form.departement) }}
{{ form_widget(form.departement) }}
</td>
<td>
{{ form_errors(form.pays) }}
{{ form_widget(form.pays) }}
</td>
</tr>
</table>
{{ form_rest(form) }}
<p>
<button type="submit">Create</button>
</p>
</form>
<ul class="record_actions">
<li>
<a href="{{ path('province') }}">
Back to the list
</a>
</li>
</ul> |
Partager