problem with passing form data between view layer and controller
Permalink
I am trying to create a simple CRUD page on a single-page that will be used by logged in users.
If I try to edit an entry, I am getting blank fields, then the entry gets added to my table instead of updating the existing entry. In looking into it, I am not getting any field data passed to my form, so key things like the record ID are not available to determine whether I need to add or update.
The assorted parts seem to be working and getting called. It just looks like the form data is missing....
Also... $_POST is empty.......
Here is my controller located at /packages/Registration/controllers/seasons.php:
and here is my view layer located at /packages/Registration/single_pages/seasons.php
I have attached three images.
Capture.gif shows data going to the view layer note that it includes seasonID
form_data.gif shows the data sent back to the controller
concrete_log.gif shows the log entries from clicking edit, entering data into the empty form and saving it. it was saved as a new record.
I fully expect to get a short quick "you missed something critical..." response, but that is the fate of the noobs.... :)
-John
If I try to edit an entry, I am getting blank fields, then the entry gets added to my table instead of updating the existing entry. In looking into it, I am not getting any field data passed to my form, so key things like the record ID are not available to determine whether I need to add or update.
The assorted parts seem to be working and getting called. It just looks like the form data is missing....
Also... $_POST is empty.......
Here is my controller located at /packages/Registration/controllers/seasons.php:
<?php // /seasons/controller.php defined('C5_EXECUTE') or die('Access Denied.'); class SeasonsController extends Controller { public function view() { Log::addEntry('SeasonsController::view id = ALL','Registration'); var_dump($_POST); var_dump($_REQUEST); // load up our database and our model $db= Loader::db(); Loader::model('seasons', 'Registration'); // create a new season object $seasons = new Seasons();
Viewing 15 lines of 93 lines. View entire code block.
and here is my view layer located at /packages/Registration/single_pages/seasons.php
<?php var_dump( $this->controller->getTask() ); $form = Loader::helper('form'); $form_date = Loader::helper('form/date_time'); switch($this->controller->getTask()) { case 'add': Log::addEntry('Seasons view::add','Registration'); ?> <div> case 'add': testing - start</div> <div>seasons.php::add</div> <div class = "ccm-ui"> <p>/seasons/view.php - add</p> <form action = "<?php echo $this->action('save') ?>" method="post"> <?php echo $form->text('name', $season['name']) ?>
Viewing 15 lines of 78 lines. View entire code block.
I have attached three images.
Capture.gif shows data going to the view layer note that it includes seasonID
form_data.gif shows the data sent back to the controller
concrete_log.gif shows the log entries from clicking edit, entering data into the empty form and saving it. it was saved as a new record.
I fully expect to get a short quick "you missed something critical..." response, but that is the fate of the noobs.... :)
-John
http://www.concrete5.org/developers/open-source/...