Queries the currently active page for the specified HTML form. If this form is found, the function submits the form to the Web server by means of the HTTP POST method and reads the response page. If the retrieved document is of content type HTML, it is parsed and embedded documents are requested.
This function is used when the form submission uses an encoding format different to ‘application/x-www-form-urlencoded’. Most common cases are file uploads which use content-type ‘multipart/form-data’. Note that the default value pairs of the HTML form are not automatically used for submission. The body message has to be supplied as a whole.
Form identification rules are listed herein, ordered by priority:
HTML forms to be queried are identified by a name:
<form name="form1" action="data2html.asp">
<input type=hidden name="cantfind" value="#b21334a45">
<input type=text name=ShoeSize value=44>
</form>
The “value” attribute of the submit button:
<form name="form1" action="data2html.asp">
<input type="submit" value=Insert>
</form>
The image used for submission may provide an “alt” attribute:
<form name="form1" action="data2html.asp">
<input type="image" src=box5.gif alt="PostBox">
</form>
In the case of changing HTML form name, you can refer to the HTML form by number. All forms are numbered sequentially throughout the Web page.
WebAPI.bdh
WebPageSubmitBin( in sHtmlForm : string allownull, in sData : string, in nDataLength : number optional, in sContent : string optional, in sTimer : string optional, in nFormNo : number optional in sFrame : string optional, in hContext : number optional ): boolean;
true if the form is found and submitted successfully
false otherwise
Parameter | Description |
---|---|
sHtmlForm | The name of the HTML form to search for in the currently active Web page, or if the hContext parameter is not omitted in the specified context. Set this parameter to NULL if a name is not available or if you want to identify the HTML form only by its number. |
sData | Data to post to the server. This may also be binary data. For posting all available binary data specify STRING_COMPLETE for nDataLength and use the bin() operator for sData (see example). |
nDataLength | Amount of data that is posted to the server (in bytes). Specify STRING_COMPLETE or omit this parameter to post all available data. |
sContent | Content type string used in the request, for example, "image/gif" (optional). |
sTimer | Name of the timer used for page measurements (optional). If this parameter is omitted, no measurements are performed. |
nFormNo | Number of the Web form in the Web page (optional). If sHtmlForm is NULL, the number specifies the n-th form in the page. If sHtmlForm specifies a name, the number specifies the n-th form with the given name. |
sFrame | The name of the frame the document is assigned to (optional). If this parameter is provided, the form is searched only within this frame document. |
hContext | Context, stored by a prior call of the WebPageStoreContext function, where to search the form (optional). If this parameter is omitted the form is searched for in the actual page and all stored contexts. |
transaction TMain begin WebPageUrl("http://lab1/", "Silk Performer Test Site"); WebPageLink("File Upload Samples", "SA-FileUp Samples - Main Page"); WebPageLink("Simple", "Simple Upload Example"); WebPageSubmitBin("Upload File", "-----------------------------210021814825312\r\n" "Content-Disposition: form-data; name=\"FILE1\";" " filename=\"C:\\log.txt\"\r\n" "Content-Type: text/plain\r\n" "\r\n" "18:03:37.037 try to enter\r\n" "19:00:50.726 try to enter\r\n" "16:35:41.361 try to enter\r\n" "18:10:54.004 try to enter\r\n" "\r\n" "-----------------------------210021814825312\r\n" "Content-Disposition: form-data; name=\"SUB1\"\r\n" "\r\n" "Upload File\r\n" "-----------------------------210021814825312--\r\n", STRING_COMPLETE, "multipart/form-data", "Simple File Upload Results"); end TMain; transaction TMain1 var sData : string; begin sData := "\h0000656600760403000000003400"; WebPageUrl("http://lab1/", "Silk Performer Test Site"); WebPageSubmitBin("Upload Data", bin(sData), STRING_COMPLETE, "application/octet-stream") end TMain1;