Any MiniVend form can be used for any number of actions. The actions are
mapped by the ActionMap directive in the catalog configuration file, and are selected on the form
with either the mv_todo or mv_doit
variables.
Mapping of actions in the ActionMap directive means that the value of the submit button is scanned to determine the action. To map the string
``Place Order'' to the action submit, you would put in the catalog.cfg file:
ActionMap submit place order
And on the form you would make a submit button:
<INPUT TYPE="submit" NAME="mv_todo" VALUE="Place Order">
When the button is clicked by the user, the submit action will be performed.
To set a default action for a form, set the variable mv_doit as a hidden variable:
<INPUT TYPE="hidden" NAME="mv_doit" VALUE="refresh">
When any other submit button (for a meaningless variable, the MiniVend
demos use mv_submit
) is pressed, the mv_todo value will not be found, so the refresh action defined in mv_doit will be used.
The defined actions are:
- cancel
-
All user information (with the exception of the frames and secure variable
settings) is erased, and the shopping cart is emptied. The user is then
mv_nextpage or mv_orderpage.
- checkout
-
The shopping cart and user variables are updated, and the user is sent to
the page defined in the variable mv_checkout or the CheckoutPage directive.
- control
-
The user help, frames, security, and color/background information is
examined and settings changed if appropriate. The shopping cart and user
variables are also updated.
- refresh
-
Simply updates the user variables and returns to the page defined in
mv_orderpage.
- return
-
Updates the user variables and returns to the page defined in mv_nextpage,
or the user's last non-order/non-search page. This is difficult to use, for
it is hard to predict what that page will be. Setting mv_nextpage with the
value of a scratch variable works well.
- search
-
The shopping cart and user variables are updated, then the form variables
are interpreted and the search specification contained therein is
dispatched to the search engine -- results are returned on the defined
search page (set by mv_search_page or the search page directives).
- submit
-
Submit the form for order processing. If no order profile is defined with
the mv_order_profile variable, the order will be checked to see if the current cart contains any
items and be checked against the fields defined in the RequiredFields directive. Assuming those checks pass, the order will be submitted.
If there is an order profile defined, the form will be checked against the
definition in the order profile and submitted if the pragma
&final
is set to yes. If &final
is set to no (the default), and the check succeeds, the user will be routed to the
MiniVend page defined in mv_successpage, mv_nextpage, or mv_orderpage.
Finally, if the check fails, the user will be routed to mv_failpage,
mv_nextpage, or mv_orderpage in that order.