Question: Wizard interface with Lifecycles?

3 views
Skip to first unread message

jconti

unread,
Feb 13, 2009, 4:28:20 PM2/13/09
to Hobo Users
I need to step a user through a sequence of forms, like a "wizard". I
am considering the rails ActsAsWizard pluging or using Hobo
lifecycles.

Any comment on these two alternatives? How would a simple wizard be
expressed as a lifecycle. Would it be one model per page or some
other data organization.

TIA,
John

Brett Nelson

unread,
Feb 13, 2009, 5:49:08 PM2/13/09
to Hobo Users
With hobo the lifecycle is defined withing the model so it would
probably be multiple lifecycle pages for one model.

The reset password is working in edge (git) hobo, very cool!

Tom Locke

unread,
Feb 15, 2009, 9:41:28 AM2/15/09
to hobo...@googlegroups.com
> I need to step a user through a sequence of forms, like a "wizard". I
> am considering the rails ActsAsWizard pluging or using Hobo
> lifecycles.

I wouldn't use lifecycles unless the intermediate states make sense as
proper states that the model could stay in for a while.

Tom

afinetooth

unread,
Feb 16, 2009, 11:42:12 PM2/16/09
to Hobo Users
HI,

I have the same requirement.

I am trying to use a Hobo Lifecycle to define a multi-step wizard,
which steps a user through the creation of a Delivery.

The user is asked a series of questions, whose input builds up the
single model, Delivery. The wizard does not cross models, or use more
than one model.

The requirement also matches Tom's recommendation below, that the
intermediate steps makes sense as proper steps.

I have defined the lifecycle as follows:

--------------
lifecycle do


state :begun, :given_date, :given_time_of_day, :given_fromzip, :given_tozip, :given_service_level, :given_building_info, :requested

create :begin,
:params => [ :customer ],
:become => :begun,
:available_to => "User",
:user_becomes => :customer

transition :give_items,
{ :begun => :given_items },
:params => [ :delivery_items ],
:available_to => :all do
end

transition :give_date,
{ :given_items => :given_date },
:params => [ :date ],
:available_to => :all do
end

transition :give_time_of_day,
{ :given_date => :given_time_of_day },
:params => [ :time_of_day ],
:available_to => :all do
end

transition :give_fromzip,
{ :given_time_of_day => :given_fromzip },
:params => [ :from_zip ],
:available_to => :all do
end

transition :give_tozip,
{ :given_fromzip => :given_tozip },
:params => [ :to_zip ],
:available_to => :all do
end

transition :give_service_level,
{ :given_tozip => :given_service_level },
:params => [ :service_level ],
:available_to => :all do
end

transition :give_building_info,
{ :given_service_level => :given_building_info },
:params => [ :building_flights, :building_elevator ],
:available_to => :all do
end

end
-------

I am experiencing two issues with this approach:

1) When I use any value for :available_to besides :all, for
instance :customer, I get an error of Undefined Method
"customer_is?" (I have set the permissions properly, I believe)

2) While I can obtain a page for any of the lifecycle steps, such
as :give_date--where I get a page titled "Give date" with a button
labeled "Give date"--the page itself, which should be a form with
fields for each field indicated in :params => [ :field1, :field2,
etc ], is blank. In other words, no fields.

Submission of the form does transition the model properly though.

Can anyone help me with these two issues? Is the lifecycle code fully
cooked?

TIA,
James

afinetooth

unread,
Feb 17, 2009, 6:14:01 AM2/17/09
to Hobo Users
See this thread for the solutions to my issue:
http://groups.google.com/group/hobousers/t/4acd34d8c7619ad3

(Sorry to have piggybacked here.)

Brett Nelson

unread,
Feb 17, 2009, 11:06:48 AM2/17/09
to Hobo Users
I think it was Jakob Suder who wrote that documentation after I had
initially submitted a hacked up solution to Email Activation. I have
made minor edits to it since then though, glad you got it to work!

Brett
Reply all
Reply to author
Forward
0 new messages