Forum OpenACS Q&A: Re: Form builder troubles

Collapse
6: Re: Form builder troubles (response to 5)
Posted by Sean Redmond on
Dave, Here is the whole TCL file (there's not much more to it)
ad_page_contract {
                                                                                
    Add an a label for an ip range
                                                                                
    @author Sean Redmond (sean@jiffycomp.com)
    @creation-date 2004-04-23
    @cvs-id $Id: index.tcl,v 1.6 2002/12/17 16:43:06 nsadmin Exp $
} {
        label_id:integer,optional
}
 
set package_id [ad_conn package_id]
set context_bar [list]
 
if {[exists_and_not_null label_id]} {
        set page_title "Edit Label"
} else {
        ad_require_permission $package_id create
        set page_title "Add a Label"
}
 
 
ad_form -name new_label -form {
 
        label_id:key(v_bma_ip_labels_label_id_seq)
 
        {label:text
                {label "Label"}
                {html {size 25}}
        }
        {descrip:text(textarea)
                {label "Description"}
                {html {rows 3 cols 50}}
        }
} -select_query_name get_label -edit_data {
        db_dml update_label { *SQL* }
} -after_submit {
        ad_returnredirect "index"
}

So it's named one-label.tcl and if invoke it with something like one-label?label_id=8, I get a form with the expected values filled in (I put a few in manually). If I change anything and hit submit, I get the same page with the old values. That would seem to indicate that it's at least getting the right label_id after the submit since it returns to the same record, even though it doesn't do the update.

Thanks.