A module which provides a generic component for editing records in SQL databases, based on WsfEdit.object WsfEditSql WsfEdit
A WSF Component for editing records in SQL databases. E.g. there is a database handle 'db' (see "sql") for accessing a database with a table 'user'. In this table exist the fields 'firstname' and 'lastname' which should be editable using this comonent. Records are indexed using the field 'userid'. The field 'username' should be displayed in the form, but is not editable. Creating an editor for record 42 in this table could look like this: var editor = new WsfEditSql(42, db, "user", "userid", function() { return #file-as-template *edit_template; }); #embedded-file edit_template END-OF-TEMPLATE <form id="$id" ${add_action(cgi.url)}> Editing user '${edit_data.username}': <br/> Realname: ${edit_input("", "60", "realname")} <br/> Firstname: ${edit_input("", "60", "firstname")} </form> END-OF-TEMPLATE This object is derived from WsfEdit.
var WsfEditSql.sql_id;
The ID of the record in the databse. This is looked up in field spl_key.
var WsfEditSql.sql_db;
The database handle.
var WsfEditSql.sql_table;
The table name.
var WsfEditSql.sql_key;
The field which is used to find the record to be edited. (see also spl_id)
var WsfEditSql.get_html_core;
The function which evaluates the template. When executed, this will be context-dispatched to this object (using the '*' operator).
method WsfEditSql.edit_load();
Overloaded WsfEdit.edit_load().
method WsfEditSql.edit_save();
Overloaded WsfEdit.edit_save().
method WsfEditSql.get_html();
Overloaded WsfEdit.get_html(). Simply calls get_html_core (context-dispatched to this object) to do the real work.
method WsfEditSql.init(_sql_id, _sql_db, _sql_table, _sql_key, _get_html_core);
The Constructor. The parameters are simply copyied to the variables described above. See the general discription of this object (WsfEditSql) for a usage example.
Generated by SPLDOC. | http://www.clifford.at/spl/ |