Bonjour, je suis en train de m'amuser avec JQuery mobile, mais j'ai un soucis au niveau du rafraîchissement de ma page, je m'explique :
J'ai une Popup avec un formulaire à l'intérieur :
http://demos.jquerymobile.com/1.4.0/popup (Form - Bouton Sign in)
Dans mon controller :
Le code coté html
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 public function listeClubAction() { $listeClub = array(); $repository = $this->getDoctrine() ->getManager() ->getRepository('GhisFootBundle:Club'); $listeClub = $repository->findAll(); foreach ($listeClub as $key => $club) { $form = $this->createForm(new ClubType, $club); $form->createView(); $tabClub[$key]['form'] = $form->createView(); $tabClub[$key]['club'] = $club; } // popup bouton Nouveau $club = new Club(); $formNew = $this->createForm(new ClubType, $club); return $this->render('GhisFootBundle:Home:club.html.twig',array( 'tabClub' => $tabClub, 'formNew' => $formNew->createView() )); } public function addAction() { $club = new Club(); $form = $this->createForm(new ClubType, $club); $request = $this->get('request'); if ($request->getMethod() == 'POST') { $form->bind($request); $em = $this->getDoctrine()->getManager(); $em->persist($club); $em->flush(); return $this->redirect($this->generateUrl('ghis_foot_club')); } return $this->redirect($this->generateUrl('ghis_foot_home')); }
Mon soucis c'est que l’enregistrement se passe très bien mais le bouton ne fonctionne plus pour un deuxième enregistrement, la pop up ne s'ouvre plus...
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 <a href="#popupNew" data-rel="popup" data-position-to="window" class="ui-btn ui-corner-all ui-shadow ui-btn-inline ui-icon-action ui-btn-icon-left ui-btn-a" data-transition="pop">Nouveau</a> <div data-role="popup" id="popupNew" data-theme="a" class="ui-corner-all"> <div style="padding:10px 20px;"> <h3>Ajouter un club</h3> <form action="{{ path('ghis_foot_club_add')}}" method="POST"> {{ form_errors(formNew) }} <div> {{ form_label(formNew.libelle,'Club') }} {{ form_errors(formNew.libelle) }} {{ form_widget(formNew.libelle, { 'attr': {'data-clear-btn': 'true'} }) }} </div> <div> {{ form_label(formNew.selection) }} {{ form_errors(formNew.selection) }} {{ form_widget(formNew.selection) }} </div> <button type="submit" class="ui-btn ui-corner-all ui-icon-check ui-btn-icon-left">Enregistrer</button> </form> </div> </div>
je sais que JQuery Mobile génère de l'Ajax automatiquement, il y a t'il un problème au niveau des redirections de symfony?
Merci !
Partager