okay quite new to Cakephp so forgive if i make any obvious mistakes,
but i can't seem to get FormWizard work for me...
I'm trying to make a simple test form with 3 different input screen,
just to grasp the idea of the FormWizard. In every output I print the
$this->data array to see what data is saved in the Session. Is this
right?
Anyway I have the following code:
[b]Polls Controller:[/b]
class PollsController extends AppController {
var $name = 'Polls';
var $helpers = array('Html', 'Form' );
var $components = array('FormWizard');
function start() {
$ways=array("way1" => array("scrn1","scrn2","scrn3"),
"way2" => array("scrn3","scrn2","scrn1"));
$this->FormWizard->initWizard($ways);
$this->FormWizard->changeWay('way1');
}
function scrn1() {
$this->set('polltxt', 'screen1');
}
function scrn1Validate() {
$this->set('polltxt' , 'screen1validate');
return true;
}
function scrn2() {
$this->set('polltxt', 'screen2');
}
function scrn2Validate() {
$this->set('polltxt' , 'screen2validate');
return true;
}
function scrn3() {
$this->set('polltxt', 'screen3');
}
function scrn3Validate() {
$this->set('polltxt' , 'screen3validate');
return true;
}
}
[b]scrn1.ctp[/b]
<h2><?php echo $polltxt;?></h2>
<?php
echo print_r($this->data);
echo $form->create('Poll', array('action'=>'/polls/start',
'url'=>'/polls/start'));
echo $form->input('Poll.title');
echo $form->submit('Previous Step',array('name'=>'previous'));
echo $form->submit('Next Step',array('name'=>'next'));
?>
</form>
[b]scrn2.ctp[/b]
<h2><?php echo $polltxt;?></h2>
<?php
echo print_r($this->data);
echo $form->create('Poll', array('action'=>'/polls/start',
'url'=>'/polls/start'));
echo $form->input('Poll.type');
echo $form->submit('Previous Step',array('name'=>'previous'));
echo $form->submit('Next Step',array('name'=>'next'));
?>
</form>
[b]scrn3.ctp[/b]
<h2><?php echo $polltxt;?></h2>
<?php
echo print_r($this->data);
echo $form->create('Poll', array('action'=>'/polls/start',
'url'=>'/polls/start'));
echo $form->input('Poll.introtext');
echo $form->submit('Previous Step',array('name'=>'previous'));
echo $form->submit('Next Step',array('name'=>'next'));
?>
</form>
Also accompanying database tables and models have been created.
But when i move around the screens using the Next and Previous
buttons, i get problem similar as descibed in this post:
http://moeffju.net/blog/2007/07/26/about-cake-cakebakers-please-read/
: $this->data is emptied seemingly randomly, data doesn't get Saved in
the Sessions...?.
My question:
1) Can anyone direct my to a good working example on how Formwizard
can be used, kinda of a FormWizard Tutorial for simple people like me
2) If not, what am i doing wrong here ?
thank you for your attention,
Hans
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---