{
  "synLogic": "int $ret \u003d $api($1, $2, $3, $4, $5);", 
"help": "Usage:\n\&#8209;        The script may extract the \u003cform\u003e from HTML page response and save it in a Netstorm variable (say, form_buf_parameter).\n\&#8209;        Another variable (say,  form_body_parameter) is declared that will hold the body buffer after the API processes the raw form.\n\&#8209;        Then API is called \n  ns_set_form_body(\"form_buf_parameter\",\n                 \"form_body_parameter\",\n                  1,//ordinal\n                  2,//num_args\n                  \"bm\u003cForm\u003dmyValue1\",\n                  \"bmFormID\u003dmyValue2\");\n\&#8209;        Any form attributes whose value has to be replaced can be passed in \&#8209;name\u003dvalue\&#8209; format after the num_args argument.\n\&#8209;        If any attribute is to be excluded from the final form body, it should be specified as: \"name\u003d__EXCLUDE__\". Example:\n                \"SHIP_TO_ADDRESS\u003c\u003eaddress2\u003d__EXCLUDE__\");\n\&#8209;        The API parses the raw form and scans for all the < input >,  < select > and < textarea > tags, extracts their name and value attributes.\n\&#8209;        Each < input >,  < select > and < textarea > tag in the raw form is processed one by one \n\&#8209;        First the name and value attribute is decoded for following html encodings:\n  & lt;    \"<\"\n  & gt;    \">\"\n  & amp;    \"&\"\n        Then the decoded name is compared with all the \"name\u003dvalue\" pairs supplied to the API. No matter whether raw form has html encoded name and value, the API should be passed the name and value without HTML encoding. \n\&#8209;        If the name of the < input >, < select > or < textarea > tag being processed matches with name in the \"name\u003dvalue\" strings for any argument, then the current occurrence of the html tag in the form is checked whether same as the ordinal value passed to the API. If the ordinal does not match, then the value read from the form is put in the \"name\u003dvalue\" for appending to the output POST body and the current occurrence is incremented. If the ordinal matches, then the value is taken from the \"name\u003dvalue\" in the API.\n\&#8209;        Then the name and value are url encoded with special characters replaced with url encoded strings (%XX, where XX is ASCII code for the special character in hexadecimal format).  Following special characters are url encoded:\n  o          \u0027\u003c\u0027\no          \u0027\u003e\u0027\n  o          \u0027/\u0027\n  o          \u0027,\u0027\n  o          \u0027+\u0027\n  o        \u0027~\u0027\n\&#8209;        The space is replaced with \"+\".\n\&#8209;        After encoding the \"name\u003dvalue\" character string is appended to the POST body, followed by an \"\u0026\" character.\n\&#8209;        Radio buttons i.e. < input type=\"radio\" ... > get special processing. In this case if the id attribute of the radio type input tag being processed matches with the id of any of the previous occurring input tag of type radio, then that is ignored and is not appended in the POST body.\n\&#8209;        Handling for < input > tag type=\"image\", consider the following form fragment:\n  < input type=\"hidden\" name=\"bmImage\" value=\"add.x\" >\n  < input type=\"hidden\" name=\"bmImage\" value=\"add.y\" >\n  < input type=\"hidden\" name=\"bmImage\" value=\"add\" > < input class=\"button\" name=\"add\" type=\"image\" src=\"/media/images/addtobag_v1_m56577569832236562.gif\" border=\"0\" alt=\"Add To Bag\"/>\n\&#8209;        The POST body\'s fragment is created by the API as follows.\n  bmImage\u003dadd.x\u0026bmImage\u003dadd.y\u0026bmImage\u003dadd\u0026add.x\u003d48\u0026add.y\u003d17\u0026\n  < input type=\"image\" name=\"image_name\" ... >\n  in such case the \n  image_name.x\u003d\u003csome_hardcoded_integer_value\u003e image_name.y\u003d\u003csome_hardcoded_integer_value\u003e\n  is appended\n",
  "notes": "1. Variable Name -\n\ta. The variable name that is passed should neither be in url encoded nor html encoded format, else the attribute value will not be replaced. \n\tFor example if the name in form is ENDECA_SEARCH_INPUT\u003c\u003eNtt, it should not be written as ENDECA_SEARCH_INPUT%3C%3ENtt.\n\tSimilarly if it\'s name is ENDECA_SEARCH_INPUT\u0026lt;\u0026gt;Ntt, it should be given in API as ENDECA_SEARCH_INPUT\u003c\u003eNtt.\n2. num_args -\n\ta. If the num_args is less than the number of actual variable arguments supplied followed by num_args, then only the num_arg number of arguments are processed, rest are ignored by the API.\n\tb. If the num_args is more than the number of actual variable arguments supplied followed by num_args, the behavior of the API will be undefined. User should be careful while passing the number of arguments vis-à-vis the num_args.",
  "returns": "int",
  "arguments": "form_buf_param_name - Name of the NS variable  where \u0027form raw buffer\u0027 is saved\nform_body_param_name - Name of the NS variable where the API fills the body buffer\nordinal - 1 based index - determines the sequence number of the set of form_variable values to be replaced in form post body.\nnum_args - Number of variable arguments following this argument. This contains the number of html form variables whose values have to be replaced\n\nVariable number of (char *) type arguments in the format:\n\"form_variable_name\u003dform_variable_replacement_value\". \nFrom the raw form buffer, the API searches for the form_variable_name which is provided in the API, and replaces its original value in the form with the value supplied in this API.",
  "parameterization": "",
  "name": "ns_set_form_body",
  "syntax": "int ns_set_form_body(char *form_buf_param_name, char *form_body_param_name, int ordinal, int num_args, ...)",
  "javaSyntax": "",
  "cEx": "flow()\n{\n  char form_buf[] \u003d \"< form name=\"endeca_search\" method=\"post\" action=\"http://www.cavisson.com/upgrade/home.jspjsessionid\u003dYqxnTslCLpYfh4f2nhSRLdzp\" > < input type=\"hidden\" name=\"bm < Form\" value=\"endeca_search\" > < input type=\"hidden\" name=\"bmFormID\" value=\"1324115245947\" method=\"post\" action=\"http://www.cavisson.com/upgrade/home.jspjsessionid\u003dYqxnTslCLpYfh4f2nhSRLdzp\" > < input type=\"hidden\" name=\"bm < Form\" value=\"endeca_search\" > < input type=\"hidden\" name=\"bmFormID\" value=\"1324115245947\" / > < /form >\";\n\n  ns_save_string(form_buf, \"form_buf_parameter\");\n  printf(\"\\n\\nform buf saved:\\n---------------\\n%s\\n\\n\", ns_eval_string(\"{form_buf_parameter}\"));\n\n  ns_set_form_body(\"form_buf_parameter\",\n                   \"form_body_parameter\",\n                   2,//ordinal\n                   2,//num_args\n                   \"bm< Form=Value1\",\n                   \"bmFormID=Value2\");\n\n   printf(\"\\n\\nform body populated:\\n-------------------\\n%s\\n\\n\", ns_eval_string(\"{form_body_parameter}\"));\n\n   ns_web_url (\"form_post\",\n\"URL=http:\//192.168.1.35:8000/netapplication/clickScriptResult.html\",\n       \"METHOD\u003dPOST\",\n       \"HEADER\u003dAccept-Language: en-US\",\n       \"HEADER\u003dContent-Type: application/x-www-form-urlencoded\",\n       \"HEADER\u003dContent-Length: 61\",\n       \"HEADER\u003dCache-Control: no-cache\",\n       \"BODY\u003d{form_body_parameter}\");\n}\n\n//Sample Request Body: \"bm%3CForm\u003dendeca_search\u0026bmFormID\u003d1324115245947\u0026bm%3CForm\u003dValue1\u0026bmFormID\u003dValue2\"",
  "javaEx": "",
  "insertStrC": "ns_set_form_body(char *form_buf_param_name, char *form_body_param_name, int ordinal, int num_args, ...);",
  "insertStrJava": "",
  "description": "The ns_set_form_body is used to generate request body from the raw HTML source fragment containing HTML \u003cform\u003e.",
  "component" : [
	  {
      "id": "$1",
      "type": "TextField",
      "label": "Form Buffer Parameter",
      "value": "",
      "css": "p-grid p-align-center w-100-p",
      "title": "Enter form buff parameter",
      "placeHolder": "",
      "style": "",
      "isDisabled": "",
      "labelVarCheckbox": "",
      "argIndex": 0,
      "validate": {
        "inputType": "Text",
        "disabled": false,
        "required": true,
        "min": 0,
        "max": 0
      }
    },
    {
      "id": "$2",
      "type": "TextField",
      "label": "Form Body Parameter",
      "value": "",
      "css": "p-grid p-align-center w-100-p",
      "title": "Form Body parameter",
      "placeHolder": "",
      "style": "",
      "isDisabled": "",
      "labelVarCheckbox": "",
      "argIndex": 0,
      "validate": {
        "inputType": "Text",
        "disabled": false,
        "required": true,
        "min": 0,
        "max": 0
      }
    },
    {
      "id": "$3",
      "type": "TextField",
      "label": "Ordinal",
      "value": "",
      "css": "p-grid p-align-center w-100-p",
      "title": "Enter ordinal",
      "placeHolder": "",
      "style": "",
      "isDisabled": "",
      "labelVarCheckbox": "",
      "argIndex": 0,
      "validate": {
        "inputType": "Number",
        "disabled": false,
        "required": true,
        "min": 0,
        "max": 2147483647,
        "method": ""
      }
    },
    {
      "id": "$4",
      "type": "TextField",
      "label": "Number of Arguments",
      "value": "",
      "css": "p-grid p-align-center w-100-p",
      "title": "Enter number of arguments",
      "placeHolder": "",
      "style": "",
      "isDisabled": "",
      "labelVarCheckbox": "",
      "argIndex": 0,
      "validate": {
        "inputType": "Number",
        "disabled": false,
        "required": true,
        "min": 0,
        "max": 2147483647,
        "method": ""
      }
    },
    {
      "id": "$5",
      "type": "TextField",
      "label": "Argument",
      "value": "",
      "css": "p-grid p-align-center w-100-p",
      "title": "Enter argument whose value has to be replaced in “name=value” format",
      "placeHolder": "",
      "style": "",
      "isDisabled": "",
      "labelVarCheckbox": "",
      "argIndex": 0,
      "validate": {
        "inputType": "Text",
        "disabled": false,
        "required": true,
        "min": 0,
        "max": 0
      }
    }
  ]
}
