Wizard Behavior Multi-step form handling
#1
Posted 20 February 2011 - 02:09 PM

POPULAR
The demos demonstrate these features (the code can be downloaded from the extension's page).
The manual fully documents the API, gives details on useage and contains example code.
I hope you find it useful for your project.
If you have any comments, bug reports, or suggestions please add them to this thread.
Links
#2
Posted 20 February 2011 - 02:33 PM
+1
#3
Posted 20 February 2011 - 06:20 PM
The demo will need some tweaking, for it to work from a subdirectory (instead of subdomain).
<li><a href="<?php echo $this->createUrl('/demo/registration'); ?>">Registration ...
I found these so far:
views/demo/index.php: example links
views/layouts/main.php: logo image and click
views/demo/quiz/completed.php: return link
Some problem with the survey wizard (cannot find pet.php)
Continuing... and and at the same time learning how to use the extension.
Thanks.
/Tommy
#5
Posted 21 February 2011 - 07:49 PM
Yeti, on 21 February 2011 - 03:18 AM, said:
I added this line to views/demo/completed.php (line 4)
$step = ucfirst($step);
and was able to continue.
Also modified this line
echo CHtml::link('Choose Another Demo', $this->createUrl('/'));
/Tommy
#6
Posted 22 February 2011 - 05:28 PM
Unfortunately i'm not very good at reading PDFs - do you think you could provide an online HTML version of the docs, too?
#7
Posted 22 February 2011 - 07:06 PM
www.ramirezcobos.com
www.yiianswers.com
www.2amigos.us
www.getyiistrap.com
www.github.com/tonydspaniard
www.github.com/2amigos
#8
Posted 24 April 2011 - 11:43 AM
TIA,
dave
#9
Posted 27 April 2011 - 06:30 PM
How can I access the results of the previous steps?
For example - registration wizard demo:
I want to display the username / email from step1 at the top of the step2 form (Profile), and also on step3 ...
#10
Posted 09 May 2011 - 05:59 PM
Thanks a lot!
@Joblo:
Use WizardBehavior::read($step) to get the data for a particular step.
#11
Posted 18 May 2011 - 07:32 AM
#12
Posted 18 May 2011 - 11:33 AM
((Because I am way too lazy to click a link..))
#13
Posted 19 May 2011 - 01:04 AM
class CC extends CFormModel
{
public $static_field;
public $fields;
public function rules()
{
return array(
array('static_field, testF', 'required')
);
}
public function getForm()
{
return new CForm(array(
'showErrorSummary'=>true,
'elements'=>array(
'static_field'=>array(),
'testF'=>array(),
),
'buttons'=>array(
'submit'=>array(
'type'=>'submit',
'label'=>'Next'
)
)
), $this);
}
public function attributeLabels()
{
return array(
'static_field' => 'static_field'
);
}
public function __get($name)
{
if (isset($this->fields[$name]))
return $this->fields[$name];
else
return '';
}
public function __set($name, $value)
{
$this->fields[$name] = $value;
}
}
i want to add dynamical field testFi try to use __get\__set and array for values, but nothing work. any ideas?
#14
Posted 03 June 2011 - 01:16 AM
Joblo, on 27 April 2011 - 06:30 PM, said:
How can I access the results of the previous steps?
For example - registration wizard demo:
I want to display the username / email from step1 at the top of the step2 form (Profile), and also on step3 ...
use the read() method. read() will return data for all steps, read(stepName)will return data for the step stepName. See page 19 of the manual.
#15
Posted 03 June 2011 - 01:21 AM
mtc900, on 24 April 2011 - 11:43 AM, said:
TIA,
dave
Use Plot Branching Navigation
#16
Posted 07 June 2011 - 01:16 AM
I have some questions about this ext, maybe you can help me with these.
1. Let say I have two forms, A and B. Form B has a field which is a foreign key from A. The field exists on both forms, but the input process should be done in form A. And in the next form (
2. The demo just display the complete result of all process. How is the way to store those data in permanent storage (database)?
I'll be very grateful if anyone could give me the solution.
Thanks and regards.
#17
Posted 06 July 2011 - 02:20 PM
ramadhanie87, on 07 June 2011 - 01:16 AM, said:
I have some questions about this ext, maybe you can help me with these.
1. Let say I have two forms, A and B. Form B has a field which is a foreign key from A. The field exists on both forms, but the input process should be done in form A. And in the next form (
2. The demo just display the complete result of all process. How is the way to store those data in permanent storage (database)?
I'll be very grateful if anyone could give me the solution.
Thanks and regards.
HI there. I was wondering this myself for a long time. Here is what I did. Now assuming that I am only using the wizard for creating records, here is my controller:
/**
* The wizard has finished; use $event->step to find out why.
* Normally on successful completion ($event->step===true) data would be saved
* to permanent storage; the demo just displays it
* @param WizardEvent The event
*/
public function wizardFinished($event) {
$command = Yii::app()->db->createCommand();
if(isset($event->data['UserEmployeeProfile'])){
$db_array = merge_array($event->data['User'],$event->data['ContactDetails'],$event->data['UserEmployeeProfile'],$event->data['UploadPhoto']);
}else{
$db_array = array_merge($event->data['User'],$event->data['ContactDetails'],$event->data['UserEmployerProfile'],$event->data['UploadPhoto']);
}
if ($event->step===true){
$command->insert('users',$db_array);
// ...redirect to another page
$this->render('completed', compact('event'));
}else{
$this->render('finished', compact('event'));
}
$event->sender->reset();
Yii::app()->end();
}I had to test to see if UserEmployeeProfile or UserEmployerProfile was set because my wizard uses branching. Hope this helps!
#18
Posted 28 July 2011 - 10:52 AM
it seems your online demo is currently not working:
http://wizard-behavi...m-webdev.co.uk/
BR
Sebastian
#20
Posted 23 August 2011 - 03:50 AM
ramadhanie87, on 07 June 2011 - 01:16 AM, said:
I have some questions about this ext, maybe you can help me with these.
1. Let say I have two forms, A and B. Form B has a field which is a foreign key from A. The field exists on both forms, but the input process should be done in form A. And in the next form (
2. The demo just display the complete result of all process. How is the way to store those data in permanent storage (database)?
I'll be very grateful if anyone could give me the solution.
Thanks and regards.
You simply read the data from the wizard with $wizard->read($step) - $step is optional and if empty returns all steps currently stored. Inside an event handler $wizard === $event->sender - so you would do $event->sender->read($step);

Help














