Bonjour,
Je reviens une fois de plus pour un problème dans un développement symfony.
J'essaye de créer un formulaire imbriquer, mais je n'arrive pas a trouver une doc précise.
Mon premier formulaire :
Mon deuxième formulaire avec appel du premier :
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 class SmslistForm extends BaseSipsmslistForm { public function configure() { unset ($this['id_list'],$this['User_id']); $this->widgetSchema['nom_list']= new sfWidgetFormPropelChoice(array( 'model' => 'Sipsmslist', 'add_empty' => false, )); $this->widgetSchema->setHelp('nom_list',"Veuillez selectionnez une liste d'envoi."); $this->widgetSchema->setLabels(array( "nom_list"=> 'Liste', )); $this->widgetSchema->setNameFormat('sipSmslist[%s]'); } }
Ma fonction d'appel :
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 class SmsmultiForm extends BaseSipsmsForm { public function configure() { parent::configure(); unset ($this['user_id'],$this['Num_envoi'],$this['id'],$this['date_envoi']); $this->embedForm ('Smslist', new SmslistForm()); $this->setWidgets(array( "Text_sms"=> new sfWidgetFormTextarea(), )); $this->widgetSchema->setHelp('Text_sms',"Le sms ne doit pas exceder 1600 caractères."); $this->widgetSchema->setLabels(array( "Text_sms"=> 'Message', )); $this->widgetSchema->setNameFormat('sipSms[%s]'); $this->setValidators(array( "Text_sms"=>new sfValidatorString(array('required'=>true,'min_length'=>1,'max_length'=>1600), array('min_length'=>'Le message est trop court', 'max_length'=>'Le message est trop long', 'required'=>'Un message est requis', )), )); } }
Et mon _Form.php
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6 public function executeInfosmsmulti(sfWebRequest $request) { $this->profile = sfGuardUserProfilePeer::getByID($this->getUser()->getId()); $this->form = new SmsmultiForm(); }
Il me retourne cet erreur :
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
52
53
54
55
56
57
58 <?php use_stylesheets_for_form($form) ?> <?php use_javascripts_for_form($form) ?> <div id="sous_contenu_bleu"> <form action="<?php echo url_for('account/sendsmsmulti') ?>" method="post" <?php $form->isMultipart() and print 'enctype="multipart/form-data" ' ?>> <div align="center"> <table width="95%" cellspacing="0" cellpadding="2"> <?php if ($form->hasGlobalErrors()){?> <tr> <td colspan="2" class="tabcel2"> <?php Foreach ($form->getGlobalErrors() as $name=>$error){?> <h3 align="center"><strong><?php echo $error." ".$name ?></strong></h3> <?php } ?> </td> </tr> <?php } ?> <tr> <td colspan="2" class="tabcel2"> <h3 align="center"><strong>Composer votre Message</strong></h3> </td> </tr> <tr> <td width="28%" class="tabcel1"> <div align="right"> <?php echo $form['nom_list']->renderLabel();?> <br/><?php echo $form['nom_list']->renderHelp();?> </div> </td> <td width="72%" class="tabcel1"> <?php echo $form['nom_list']->render(array("style" => "width: 100px; height: 20px;"));?><?php echo $form['nom_list']->getError();?> </td> </tr> <tr> <td width="28%" class="tabcel1"> <div align="right"> <?php echo $form['Text_sms']->renderLabel();?> <br/><?php echo $form['Text_sms']->renderHelp();?> </div> </td> <td width="72%" class="tabcel1"> <?php echo $form['Text_sms']->render(array("style" => "width: 200px; height: 100px;", "id" => "LgntSMS"));?><?php echo $form['Text_sms']->getError();?> </td> </tr> <?php echo $form['_csrf_token']->render()?> <tr> <td colspan="2" class="tabcel2"> <div align="center"> <input type="submit" value="Envoyer votre message" /> </div> </td> </tr> </table> </div> <script type="text/javascript" src="functions.js"></script> </form> </div>
Widget "nom_list" does not exist.
Alors qu'il devrait le trouver, vu qu'il est passé du premier formulaire au deuxième.
Si quelqu'un a une idée, ça m'avancerait grandement.
Merci d'avance
Partager