WebFormValueSet Function

Action

Sets 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

WebFormValueSet( in fForm       : form,
                 in sLeftValue  : string allownull,
                 in sRightValue : string allownull,
                 in nPosition   : number optional
                 in nAttribute  : number optional ): boolean;

Return value

  • true if successful

  • false otherwise

Parameter Description
fForm Web form whose content will be modified
sLeftValue String representing the left-side value to set or to search for, depending on the nPosition parameter
sRightValue String representing the right-side value to set or to search for, depending on the nPosition parameter
nPosition

Position of the Web form entry whose values will be set (optional).

If this parameter is passed to the function, the function behaves as follows:

  • If sRightValue is not NULL, both values are set, the left-side value to sLeftValue, and the right-side value to sRightValue

  • If sRightValue is NULL, the specified left-side value is set to sLeftValue

  • If sLeftValue is NULL, the specified right-side value is set to sRightValue

Otherwise, if this parameter is omitted, Silk Performer searches the Web form for a matching left-side value and sets the corresponding right-side value.

nAttribute Attribute of the pair of values (optional). If this value is omitted no special attribute is assigned. See the form attributes section in the Web form declarations section for all possible values.

Example

dcltrans
  transaction TMain
  var
    sFirstName, sLastName, sPhone: string;
  begin
    WebFormValuePairInsert(fForm, "street", "Beach Road");
    WebFormValuePairInsert(fForm, "phone", "1212-555-8532");
    WebFormValueGet(fForm, sFirstName, STRING_COMPLETE, "first name");
    WebFormValueGet(fForm, sLastName, STRING_COMPLETE, "last name");
    WebFormValueGet(fForm, sPhone, STRING_COMPLETE, "phone");
    write("first name = "); write(sFirstName); writeln;
    write("last name = "); write(sLastName); writeln;
    write("phone = "); write(sPhone); writeln;
    WebFormValueSet(fForm, "phone", "1411-555-0969",
0, USE_HTML_VAL);
    WebFormValueGet(fForm, sPhone, STRING_COMPLETE, "phone");
    write("phone = "); write(sPhone); writeln;
    WebFormValuePairRemove(fForm, "street");
    WebFormClear(fForm);
  end TMain;

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

Sample scripts

WebForms04.bdf