WBF_field - sending field values as request
variables
Syntax
WBF_DBFieldName=value for
DBFieldName
Syntax example (GET method)
WBF_ISBN=0201694085
Syntax example (POST method)
< input
type="hidden" name="WBF_ISBN" value="0201694085">
Valid inputs
Any text and/or numeric value, including WhizBase tags
and functions, that will be accepted by DBField (e.g. do not send text to a
numeric or date/time field).
Default value
none
Description
Form fields with name starting with WBF_ are used
to carry a value for specific database field. The name of the field is specified
after WBF_ prefix and it has to be exactly the same as in the
database. The action that will be performed with received value depends upon
value of the WB_Command and (for some WB_Command
values) WB_UID. Basically the most common case is that
this value will be used to filter records (WB_Command values Q, D, P, L). In other cases the value will be
stored in database field (WB_Command values A and U). The exception to this rule is if field name
following the WBF_ prefix is the same as field name defined in WB_UID variable
and WB_Command value is U. In this case received value for that field will be
used to identify the record to be updated and all other WBF_ values will be
stored to proper database fields.
The best way to illustrate usage of these fields is example.
[FormFields]
WB_Command=q
WB_Basename=biblio.mdb
WB_Rcdset=titles
wb_showlogo=F
[MsgAndLbl]
WB_Style=font-family:verdana;font-size:12px;color:#CC0000;
<!--WB_BeginTemplate-->
<html>
<head>
<style>
.wbspttbl{
border:1px
solid
#000000;
font-family:verdana;
font-size:12px;
border-collapse:collapse;
border-spacing:0px;
}
.wbspthdr{
background-color:#CC0000;
border:1px
solid
#000000;
color:#C0C0C0;
}
.wbsptrow{
background-color:#FFCC00;
border:1px
solid #000000;
color:#0000CC;
}
</style>
<title>Simple
database search
example</title>
</head>
<body>
<form method="POST"
action="$wbe[script_name]">
Title: <input type="text" name="WBF_Title"
size="20"><br>
Year published: <input type="text" name="WBF_Year
published" size="20"><br>
<input type="radio" value="And" checked
name="WB_AndOr">AND <input type="radio" name="WB_AndOr"
value="Or">OR<br>
<input type="submit" value="Go"
name="B1">
</form>
$wbdetail[t]
</body>
</html>
Run the file with this example code and experiment with various values for
"Title" and "Year published" fields, and try changing AND/OR form
values.
There are few rules:
- To let user search through specific field just send form field named
exactly as database field with prefix WBF_ (don't forget the underscore) to a
WBSp file with WB_Command=Q
- Depending on WB_AndOr field WBSP engine will return records that meet all
the conditions (AND) or any of the conditions (OR) (WB_Command values Q, D, P
or L)
- If user leaves any of the fields empty, those fields will be ignored (all
WB_Command values)
- If WB_Command value is Q, D, P or L:
- All SQL pattern rules are supported
- In Numeric and Date fields user can enter characters for comparison at
the beginning of entered value (> greater than, < less then, >=
greater or equal,<= less or equal and <> not equal)
e.g.
<input type="hidden" name="WBF_Year published"
value=">1999">
<input type="hidden" name=
"WBF_Yearpublished"value="=<2000">
Try typing comparison characters
as a part of form field in example above
- If WB_Command value is U
- To update database field to NULL value send exactly the same value in
WBF_field and WB_Null variables (text and memo
field types only)
- To store new value that is related to old one use update prefixes
These variables can not be part of WBSP file - they
can only be sent by client as a part of http (or https) request using either
POST or GET method.