Howdy,
I searched the Knop archive for help, but came up empty with "step", "next" and "sequence".
I would like to have a sequence of forms that progress through ordered steps, sort of like a survey. The steps must be performed in order. A user may resume where they left off. Each step has some validation logic. How would I implement this using Knop?
Handling the failure is no problem: just reload the form. But for the success, I'm trying to figure out the best way to load the next Knop form in the sequence.
First, I assume that the application logic should go into the action file, correct?
If so, then here is some sample code I pulled from the Knop demo files.
_action/act_advanced_edit.inc
-----------------------------
if($f -> isvalid); // edited for brevity
// add record
// update session variable
// uhh.... magic? use an include or redirect_url?
/if;
if: (!($f -> isvalid) || $f -> error_code)
&& ($f -> getbutton == 'add' || $f -> getbutton == 'save');
// remain on the same path to show form again
$nav -> (setlocation: ($nav -> actionpath));
// show error message
$message -> (insert: ($f -> error_msg) + ' ' + ($f -> error_code));
/if;
If I understand that correctly, then the value of the -formaction parameter in the knop form object in the config file determines what is the next page in the sequence:
_config/cfg_advanced_edit.inc
-----------------------------
var: 'f'=(knop_form:
-formaction=($nav -> (url: 'advanced')), // action attribute for the html form
-method='post',
-database=$d,
-actionpath='advanced/edit', // framework action path
Is -formaction the "magic" that tells Knop what to load next?
--steve
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Steve Piercy Web Site Builder Soquel, CA
<
web@...> <
http://www.StevePiercy.com/>
--
#############################################################
This message is sent to you because you are subscribed to
the mailing list <
knop@...>.
To unsubscribe, E-mail to: <
knop-off@...>
Send administrative queries to <
knop-request@...>
List archive
http://www.nabble.com/Knop-Framework-Discussion-f29076.htmlProject homepage
http://montania.se/projects/knop/Google Code has the latest downloads at
http://code.google.com/p/knop/