Hilfe: SQLEdit, Add/EditWith SQLEdit you can connect to database tables. SQLEdit enables to add ,
modify and delete every kind of data on database tables, also related one to
another with foreing keys.
To configure this Wobject you can simply select the database link and a table
name. Automatically a web form will be added with all columns table.
Wobject properties.
Referer page.
Configure a url to an optional caller page. This page can be, e.g., a page
with an SQLReport Wobject from which, click on an add/edit button, your users
can access this object. This link will be used when you "save and come back".
Debug enabled?
If set to true, show executed SQL query and eventual errors. If disables, no
errors will be showed.
Layout.
Template
Select a template for your form. Take a look at
template variables and an example about
template usage
Default field template
The defaul template for fields to use when "field template" is set to "inherited".
Take a look at template variables and an example
about template usage. This parameter
is not used if template module don't have a <TMPL_VAR
NAME="form.fields.template"> parameter but a <TMPL_LOOP
name="fields_loop"> loop.
Begin a new form?
If set, a template parameter named "form.begin" will be set to 1. This
parameter can be used to print FORM tag.
End the form?
If set, a template parameter named "form.end " will be set to 1. This
parameter can be used to add a submit button and the closed FORM tag.
Visible
A perl script that must return a boolean (1|0). It defines if the complete
element will be rendered on the page or not. You can use WebGUI macros. They
will be expanded before script will be compiled.
Privileges.
Database Link
The administrator can configure common databases on which you can run SQL
Reports, freeing you from having to know or enter the DSN, Username, and
Password. If a database is selected from this list, the DSN, User, and Password
fields will be ignored. If the database you need to use is not configured as a
Database Link, you can enter the DSN, User, and Password.
DSN
Data Source Name is the unique identifier that Perl uses to
describe the location of your database. It takes the format of DBI:[driver]:[database
name]:[host].
Example: DBI:mysql:WebGUI:localhost
Database User
The username you use to connect to the DSN.
Database Password
The password you use to connect to the DSN.
Table name.
The table name you wish to manage. If you set a valid DSN value it will be
possible to select table from a list of all table available in the database.
Events
onLoad A PERL function. This function will be evaluated before load
form and before every database operation. It can be usefull to change SQLEdit
mode visualization. As an example, you could want that some users cannot add new
records, but can only change their own record. Function gets an hashref with
these elements:
session_form: an hashref with all
parameters, via GET o via POST, with which page has been opened.
Example: $_[0]->{session_form}->{exec}
onBeforeEdit A PERL function. This function will be evaluated before showing form
but after fetch database values. Then
it can be used to initialize or however, to change fields value. Function gets
an hashref with these elements:
fld_values: an hashref with form fields value
and, as key, columns name
Example: $_[0]->{fld_values}->{id}
fld_pers: contiene un riferimento ad un hash
con i valori di personalizzazione (tabella SQLEdit_field), con chiave, il nome della colonna del database.
Ogni elemento di questo hash è un riferimento ad un altro hash con chiave, le
colonne della tabella SQLEdit_field
Example: $_[0]->{fld_pers}->{id}->{type}
tmpl_var: an hashref with
template parameters. But don't use this parameter to set fields value.
Example: $_[0]->{tmpl_var}->{'form.isNew'}
onBeforeSave A PERL function. This function will be evaluated before
saving data into database. Then
it can be used to change fields value before they are saved into database.
Function gets an hashref with these elements:
fld_values: an hashref with form fields value
and, as key, columns name
Example: $_[0]->{fld_values}->{id}
cancel: it can be set with an error
message. If is not empty, operation will be cancel and error message will be
showed to user.
Example: $_[0]->{cancel} = '^International(38);';
onBeforeCancel A PERL function. his function will be evaluated before
deleting a record. Function gets an hashref with these elements:
cancel: it can be set with an error
message. If is not empty, operation will be cancel and error message will be
showed to user.
Example: $_[0]->{cancel} = '^International(38);';
Siehe auch: |