Yii Framework Forum: Wizard Behavior - Yii Framework Forum

Jump to content

  • (4 Pages)
  • +
  • 1
  • 2
  • 3
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

Wizard Behavior Multi-step form handling Rate Topic: ***** 4 Votes

#1 User is offline   Yeti 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 98
  • Joined: 30-May 09

Posted 20 February 2011 - 02:09 PM

*
POPULAR

Wizard Behavior is an extension that simplifies the handling of multi-step forms. It features data persistence, Plot-Branching Navigation (PBN), Next/Previous or Forward Only navigation, optional step timeout, invalid step handling, save and recover wizards between sessions, and has utility methods for use in views to assist navigation.

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

6

#2 User is offline   eval 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 85
  • Joined: 25-November 08
  • Location:Athens - Greece

Posted 20 February 2011 - 02:33 PM

Thanks for sharing! Haven't tried it yet but looking at the demos it seems very nice :)

+1
0

#3 User is online   tri 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 1,651
  • Joined: 20-November 08
  • Location:Stockholm, Sweden

Posted 20 February 2011 - 06:20 PM

Looks like a great extension.

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
Don't forget to read The Definitive Guide to Yii (en) (sv) | The class reference has the details
0

#4 User is offline   Yeti 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 98
  • Joined: 30-May 09

Posted 21 February 2011 - 03:18 AM

View Posttri, on 20 February 2011 - 06:20 PM, said:

Some problem with the survey wizard (cannot find pet.php)


Please give more details; all the demos seem to be working just fine.
0

#5 User is online   tri 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 1,651
  • Joined: 20-November 08
  • Location:Stockholm, Sweden

Posted 21 February 2011 - 07:49 PM

View PostYeti, on 21 February 2011 - 03:18 AM, said:

Please give more details; all the demos seem to be working just fine.


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
Don't forget to read The Definitive Guide to Yii (en) (sv) | The class reference has the details
0

#6 User is offline   Mike 

  • Elite Member
  • PipPipPipPipPip
  • Yii
  • Group: Members
  • Posts: 3,016
  • Joined: 06-October 08
  • Location:Upper Palatinate

Posted 22 February 2011 - 05:28 PM

Looks like a very cool extension, thanks!

Unfortunately i'm not very good at reading PDFs - do you think you could provide an online HTML version of the docs, too? ;)


0

#7 User is offline   Antonio Ramirez 

  • Elite Member
  • Yii
  • Group: Yii Dev Team
  • Posts: 1,450
  • Joined: 04-October 10

Posted 22 February 2011 - 07:06 PM

Thanks for sharing... btw, i couldn't get out from the first step (something wrong with password validations)
┬┐How long would it take for you to understand that you own nothing in this world?

www.ramirezcobos.com
www.2amigos.us
www.github.com/tonydspaniard
www.github.com/2amigos


Posted Image
1

#8 User is offline   mtc900 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 24-April 11

Posted 24 April 2011 - 11:43 AM

This extension is extremely helpful in my development. However, I would like to provide multiple links or buttons to replace the "next" (submit) button instead of having the user select a choice with a checkbox or similar. For example, say during a registration process you must select a type of product. Having the list and descriptions of the product types and a link next to each I would like the wizard to pick up at the next step with that information. Does anyone have an idea how to make that happen with the Wizard Behavior?

TIA,
dave
0

#9 User is offline   Joblo 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 689
  • Joined: 12-September 10
  • Location:Austria

Posted 27 April 2011 - 06:30 PM

What's the easiest way to display input results from previous steps to the user when he is working on a step?
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 ...
0

#10 User is offline   jacmoe 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 2,601
  • Joined: 10-October 10
  • Location:Denmark

Posted 09 May 2011 - 05:59 PM

Awesome extension!
Thanks a lot! :lol:

@Joblo:
Use WizardBehavior::read($step) to get the data for a particular step.
"Less noise - more signal"
0

#11 User is offline   kusanagi 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 57
  • Joined: 06-December 10

Posted 18 May 2011 - 07:32 AM

who can help with this ext? here is the q. http://stackoverflow...amic-properties
0

#12 User is offline   jacmoe 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 2,601
  • Joined: 10-October 10
  • Location:Denmark

Posted 18 May 2011 - 11:33 AM

Are you too lazy to post the question here??

((Because I am way too lazy to click a link..))
"Less noise - more signal"
0

#13 User is offline   kusanagi 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 57
  • Joined: 06-December 10

Posted 19 May 2011 - 01:04 AM

i got such form
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 testF

i try to use __get\__set and array for values, but nothing work. any ideas?
0

#14 User is offline   Yeti 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 98
  • Joined: 30-May 09

Posted 03 June 2011 - 01:16 AM

View PostJoblo, on 27 April 2011 - 06:30 PM, said:

What's the easiest way to display input results from previous steps to the user when he is working on a step?
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.
0

#15 User is offline   Yeti 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 98
  • Joined: 30-May 09

Posted 03 June 2011 - 01:21 AM

View Postmtc900, on 24 April 2011 - 11:43 AM, said:

This extension is extremely helpful in my development. However, I would like to provide multiple links or buttons to replace the "next" (submit) button instead of having the user select a choice with a checkbox or similar. For example, say during a registration process you must select a type of product. Having the list and descriptions of the product types and a link next to each I would like the wizard to pick up at the next step with that information. Does anyone have an idea how to make that happen with the Wizard Behavior?

TIA,
dave


Use Plot Branching Navigation
0

#16 User is offline   ramadhanie87 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 9
  • Joined: 27-April 11

Posted 07 June 2011 - 01:16 AM

Hello guys, i am a newbie in yii and now i'm trying to implement a wizard behavior in my application.
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 (B) the field has to be shown again with the value that automatically retrieved from A. How could I do this? How to retrieve a particular value from the previous step?

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.
0

#17 User is offline   Pirificio 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 05-July 11

Posted 06 July 2011 - 02:20 PM

View Postramadhanie87, on 07 June 2011 - 01:16 AM, said:

Hello guys, i am a newbie in yii and now i'm trying to implement a wizard behavior in my application.
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 (B) the field has to be shown again with the value that automatically retrieved from A. How could I do this? How to retrieve a particular value from the previous step?

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!
0

#18 User is offline   Sebastian K. 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 65
  • Joined: 29-May 11

Posted 28 July 2011 - 10:52 AM

Hi guys,

it seems your online demo is currently not working:
http://wizard-behavi...m-webdev.co.uk/

BR
Sebastian
0

#19 User is offline   Yeti 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 98
  • Joined: 30-May 09

Posted 23 August 2011 - 03:41 AM

The demo is working again
0

#20 User is offline   Yeti 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 98
  • Joined: 30-May 09

Posted 23 August 2011 - 03:50 AM

View Postramadhanie87, on 07 June 2011 - 01:16 AM, said:

Hello guys, i am a newbie in yii and now i'm trying to implement a wizard behavior in my application.
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 (B) the field has to be shown again with the value that automatically retrieved from A. How could I do this? How to retrieve a particular value from the previous step?

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);
0

Share this topic:


  • (4 Pages)
  • +
  • 1
  • 2
  • 3
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users