A form declaration consists of a form name with an optional form attribute and a list of form fields.
The form name can be any valid identifier string, for example FORM_NAME. If an attribute is specified, it must consist of an identifier within angle brackets, for example < ENCODE_ESCAPE >. The form name must be separated by a colon from the list of form fields.
The subsequent list specifies the fields of a web form or the parameters of a URL string. The string or variable on the left specifies the name of the field or parameter. An empty string is allowed for nameless URL parameters, such as image map coordinates. The right value specifies the data value of the field or parameter; this can be any expression with return type 'string', 'number' or 'float'.
The expression may use global constants, variables and random variables, BDL functions or external functions.
The list of form fields may be empty, resulting in an empty form. However, if you need an empty form, you can use the predefined empty form called FORM_NULL from the kernel.bdh include file.
FormsSection = { FormsDeclaration }. FormsDeclaration = ident [ Attr ] ":" [ FormItem { "," FormItem } ] ";". FormItem = FormItemName ":=" FormItemValue [ Attr ]. FormItemName = FormExpression. FormItemValue = FormExpression. FormExpression = numeric expression | string expression Attr = "<" ( numeric expressionident ) ">".
The optional attributes of a form or a form field must evaluate to a number value. While the compiler accepts any value, only those described herein have an effect. These values are named constants, defined in the kernel.bdh include file. Sometimes it makes sense to combine two or more attribute values using the bitwise-or operator '|'.
There are two groups of attributes: Usage attributes (only applicable for form fields in forms that are used context-full) and encoding attributes. Named constants for attributes are defined in the kernel.bdh include file.
Usage attributes:
Encoding attributes:
Encoding attributes specify how the unsafe characters in a field name or field value must be encoded. This is important to accommodate different encoding strategies used by different browsers in different situations.
Attribute of a form vs. attribute of a form field
The encoding attribute of a form (as a whole) specifies the default-encoding attribute for form fields that have no encoding attribute on their own.
For example, if all form fields should use the attribute ENCODE_ESCAPE, you can specify this attribute after the form name. This encoding attribute is then used for all form fields. You can still override the encoding attribute for individual form fields by specifying another attribute for some fields.
dclform CGI_CUST_SUPPORT: "email" := "support@company.com", "platform" := "Windows NT"; AD_SERVER_PARAMS <ENCODE_NONE>: "~userpref" := "12|34|56", "~requesttime" := "01/01/2002"; FORM_REDIR_LOGIN <ENCODE_NONE> : "~language" := "EN", "~logingroup" := "GUEST", "~transaction" := "TEST", "~exitUrl" := "http://www.myserver.com/ goodbye.html"; SHOPIT_KINDOFPAYMENT: "choice" := "Cash", "price" := ""5.90 <USE_HTML_VAL> , "paymentButton" := "" <USE_HTML_VAL> ; CGI_BIN_001: "BV_SessionID" := "" <USE_HTML_VAL>, "BV_EngineID" := "" <USE_HTML_VAL>, "TargetOID" := "" <USE_HTML_VAL>; LOGIN_FORM_001: "username" := "testuser" + string(GetUserId()), "password" := "testpassword", "hash" := "" <USE_HTML_VAL_ENCODE_NONE>, "platform" := "OS: Win2000, Browser: IE5.5, Timezone: GMT-0300" <ENCODE_NONE>;