Forum OpenACS Q&A: I can't get myfirstpackage (tutorial example in doc) to work

I can't get it to work and I've been working on it for so long...I got it to display fine, but when I add the note, it messes up. This is the error message I get:

Required switch -item_id not provided
while executing
"mfp::note::add__arg_parser"
(procedure "mfp::note::add" line 1)
invoked from within
"mfp::note::add -title $title"
("uplevel" body line 2)
invoked from within
"uplevel #$level $new_data"
("1" arm line 598)
invoked from within
"switch $errno {
0 {
# TCL_OK
}
1 {
# TCL_E..."
(procedure "ad_form" line 612)
invoked from within
"ad_form -name note -form {
{item_id:key}
{title:text {label Title}}
} -new_request {
auth::require_login
permission::require_permissio..."
("uplevel" body line 13)
invoked from within
"uplevel {
ad_page_contract {
This is the view-edit page for notes.

@author Your Name (mailto:you@example.com)
@cvs-id $Id: tutorial-pages..."
(procedure "code::tcl::/var/lib/aolserver/tedle/packages/myfirstpackage/..." line 2)
invoked from within
"code::tcl::$__adp_stub"
invoked from within
"if { [file exists $__adp_stub.tcl] } {

# ensure that data source preparation procedure exists and is up-to-date
adp_init tcl $__adp_stub
..."
("uplevel" body line 3)
invoked from within
"uplevel {

if { [file exists $__adp_stub.tcl] } {

# ensure that data source preparation procedure exists and is up-to-date
adp_init t..."
(procedure "adp_prepare" line 2)
invoked from within
"adp_prepare "
(procedure "template::adp_parse" line 30)
invoked from within
"template::adp_parse [file root [ad_conn file]] {}"
(procedure "adp_parse_ad_conn_file" line 5)
invoked from within
"$handler"
("uplevel" body line 2)
invoked from within
"uplevel $code"
invoked from within
"ad_try {
$handler
} ad_script_abort val {
# do nothing
}"
invoked from within
"rp_serve_concrete_file [ad_conn file]"
(procedure "rp_serve_abstract_file" line 60)
invoked from within
"rp_serve_abstract_file "$root/$path""
("uplevel" body line 2)
invoked from within
"uplevel $code"
invoked from within
"ad_try {
rp_serve_abstract_file "$root/$path"
set tcl_url2file([ad_conn url]) [ad_conn file]
set tcl_url2path_info..."

David,

could you post the ad_form code you're using....

Matthew

ad_form -name note -form {
{item_id:key}
{title:text {label Title}}
} -new_request {
auth::require_login
permission::require_permission -object_id [ad_conn package_id] -privilege create
set page_title "Add a Note"
set context [list $page_title]
} -edit_request {
auth::require_login
permission::require_write_permission -object_id $item_id
mfp::note::get \
-item_id $item_id \
-array note_array

set title $note_array(title)

set page_title "Edit a Note"
set context [list $page_title]
} -new_data {
mfp::note::add \
-title $title
} -edit_data {
mfp::note::edit \
-item_id $item_id \
-title $title
} -after_submit {
ad_returnredirect "."
ad_script_abort
}
As said you did not pass the parameter item_id when calling mfp::note::add. I guess
ad_form -name note -form {
...
} -new_data {
    mfp::note::add \
	-title $title \
        -item_id $item_id
} -edit_data {
should do it.