WebFormValueGet Function

Action

Retrieves the left-side and/or the right-side value of a Web form entry. This function can be used to dynamically modify the content of a Web form.

Include file

WebAPI.bdh

Syntax

WebFormValueGet( in  fForm      : form,
                 out sValue     : string,
                 in  nValueSize : number,
                 in  sLeftValue : string,
                 in  nPosition  : number optional,
                 in  bGetLeft   : boolean optional,
                 out nAttribute : number optional): boolean;

Return value

  • true if successful

  • false otherwise

Parameter Description
fForm Web form whose content will be retrieved.
sValue String receiving the specified value of a Web form entry.
nValueSize Length of the string receiving the value.
sLeftValue String representing a left-side value to search for.
nPosition

Position of the Web form entry (optional).

If this parameter is passed to the function, the function returns either the right-side or the left-side value of the specified entry, depending on the bGetLeft parameter

Otherwise, if this parameter is omitted, this function searches the specified Web form for a left-side value equal to sLeftValue and returns the corresponding right-side value.

bGetLeft Specifies whether to return the left-side or the right-side value of a given Web form entry (optional). If this parameter is passed to the function, the function retrieves the left-side value instead of the right-side value.
nAttribute If this parameter is not omitted it receives the attribute of the specified pair of values.

Example

dcltrans
  transaction TMain
  var
    sString, sFirstName, sLastName, sPhone : string;
    nAttrFirst, nAttrLast                  : number;
  begin
    WebFormValuePairInsert(fForm, "street", "Beach Road");
    WebFormValuePairInsert(fForm, "phone", "1212-555-8532");
    WebFormValueGet(fForm, sFirstName, sizeof(sFirstName),
"first name", 0, false, nAttrFirst);
    WebFormValueGet(fForm, sLastName, sizeof(sLastName),
"last name", 0, false, nAttrLast);
    WebFormValueGet(fForm, sPhone, sizeof(sPhone), "phone");
    write("first name = "); write(sFirstName);
    write(", attribute = "); write(nAttrFirst); writeln;
    write("last name = "); write(sLastName);
    write(", attribute = "); write(nAttrLast); writeln;
    write("phone = "); write(sPhone); writeln;

    // retrieve the left-hand value of the first pair
    WebFormValueGet(fForm, sString, sizeof(sString), "", 1, true);
    WebFormValueSet(fForm, "phone", "1411-555-0969");
    WebFormValueGet(fForm, sPhone, sizeof(sPhone), "phone");
    write("phone = "); write(sPhone); writeln;
    WebFormValuePairRemove(fForm, "street");
    WebFormClear(fForm);
  end TMain;

dclform
  fForm:
    "first name" := "Peter" <ENCODE_CUSTOM>,
    "last name"  := "Heart";

Sample scripts

WebForms04.bdf