lundi 7 juillet 2014

Cakephp ajax form won't load the right view


Vote count:

0




I'm just trying to call a function from a form submision (which is also call from ajax).


I want to call the add method but it's the index which always called.


My ajax view with the ajax submission form :



<?php $count = count($files); ?>
<div id="message"></div>
<i><?= __('Nombre de fichiers liés : ') . $count ?></i>
<?= $this->Form->create('FilesManager', array('enctype' => 'multipart/form-data', 'url' => array('action' => 'add'))); ?>
<?= $this->Form->input('file', array('type' => 'file', 'label' => false, 'class' => 'form-control')); ?>
<?= $this->Js->submit('Envoyer', array('update' => '#message', 'div' => false, 'type' => 'json', 'async' => false)); ?>
<?= $this->Js->writeBuffer(); ?>


i've also tried :



<?= $this->Form->create(null, array('enctype' => 'multipart/form-data', 'url' => array('controller' => 'FilesManagers', 'action' => 'add'))); ?>

<?= $this->Form->create('FilesManager/add', array('enctype' => 'multipart/form-data')); ?>


asked 1 min ago






Aucun commentaire:

Enregistrer un commentaire