Hello Jon,
With this sample I was able to create the drop down list. However I do have an additional problem. How it works now:
I have the first_names||' '||last_name in drop down menu. By selecting a name, I pass an object_id to the DB table "project". However, I would like to pass an additional paramater - a coresponding email to the email_sub_name in the same table...
Thank you for your time.
DanielD
Here is the code I have so far:
("Maintainers" query has a column, "email". But how to pass this value to different column in project table?)
ad_page_contract {
Simple add/edit form for d-bug_project.
} {
{project_id:integer,optional}
}
set user_id [ad_maybe_redirect_for_registration]
set title "Add a Project"
set maintainers [db_list_of_lists get_maintainers "SELECT first_names||' '||last_name, email, object_id FROM cc_users;"]
if {[exists_and_not_null project_id]} {
set title "Edit a Project"
}
ad_form -name d-bug_project_edit -form {
project_id:key(dbg_dbg_id_sq)
{description:text(textarea)
{label "Description"}
}
{maintainer:text(select)
{label "Maintainer"} { options {$maintainers} {value $object_id}}
}
} -select_query {
SELECT *
FROM project
WHERE project_id = :project_id
} -new_data {
db_dml do_insert_project "
INSERT INTO project
VALUES (
:project_id,
:description,
:maintainer,
:email,
:user_id
)
"
} -edit_data {
db_dml do_update_project "
UPDATE project
SET project_id = :project_id,
description = :description,
maintainer = :maintainer,
email_sub_name = :email,
creator = :user_id
WHERE project_id = :project_id"
} -after_submit {
ad_returnredirect "index"
}