class Form
All Implemented Interfaces:
Provides support for legacy HTML GET and POST forms. Allows the submission of forms with arbitrary
key-value pairs as well as file upload.
Prompting the user for a file upload field (promptForFile()) is only supported in
Microsoft Internet Explorer.
Since:
3.0
| Field Summary |
|---|
| static String | Event type published when a file has been chosen through user interaction. |
| static String | Event type published when a security error occurs trying to access the response. |
| static String | Event type published when the response has loaded. |
| static String | Event type published when the response is still not ready after the specified timeout period. |
| static String | |
| static String | |
| Constructor Summary |
|---|
| void | instance initializer |
| Method Summary |
|---|
| void | Stops polling for a response. |
| void | Adds a file upload field to this form. |
| void | Hides the IFRAME containing this form after it has been shown by calling reveal(). |
| void | Destroys the form and the hidden IFRAME. |
| String | Returns the action of this form, the URL that this form is submitted to. |
| String | Returns the value of a field in this form. |
| Array<String> | Returns the names of all fields in this form. |
| String | Returns the method of this form. |
| boolean | Returns whether this form is multipart. |
| String | Returns the content of the response as a string. |
| jsx3.xml.Document | Returns the content of the response as an XML document. |
| static jsx3.net.Form | Creates a new form and initialize it from the HTML representation of a form. |
| void | Invokes the operating system file browser to choose a file for a file upload field. |
| void | Removes a field from this form. |
| void | Reveals the IFRAME containing this form for debugging purposes. |
| void | Sends the form. |
| void | Sends the form. |
| void | Sets the action of this form. |
| void | Sets the value of a field in this form. |
| void | Sets the method of this form. |
| void | Sets whether this form is multipart. |
| Methods Inherited From jsx3.lang.Object |
|---|
| clone, equals, eval, getClass, getInstanceOf, getInstanceOfClass, getInstanceOfPackage, instanceOf, isInstanceOf, isSubclassOf, jsxmix, jsxsuper, jsxsupermix, setInstanceOf, toString |
static final
String EVENT_FILE_SELECTED
Event type published when a file has been chosen through user interaction. The event has properties field and value.
static final
String EVENT_ON_ERROR
Event type published when a security error occurs trying to access the response.
static final
String EVENT_ON_RESPONSE
Event type published when the response has loaded.
static final
String EVENT_ON_TIMEOUT
Event type published when the response is still not ready after the specified timeout period.
static final
String METHOD_GET
static final
String METHOD_POST
instance initializer
Parameters:
strMethod – form method, METHOD_GET (default) or METHOD_POST
strAction – the URL to submit to
bMultipart – if true the form can support file upload
void abort()
Stops polling for a response.
void addFileUploadField(strName
: String)
Adds a file upload field to this form.
Parameters:
strName – the name of the new field.
void conceal()
Hides the IFRAME containing this form after it has been shown by calling reveal().
Since:
3.2
See Also:
void destroy()
Destroys the form and the hidden IFRAME. This method should be called after receiving an onResponse, onError, or
onTimeout event for proper garbage collection.
Returns the action of this form, the URL that this form is submitted to.
Returns:
action
Returns the value of a field in this form.
Parameters:
strName – the name of the form field to query.
Returns:
the field value or null if no such field exists.
Returns the names of all fields in this form.
Returns:
Returns the method of this form.
Returns:
METHOD_GET or METHOD_POST.
Returns whether this form is multipart. Only multipart forms may upload files.
Returns:
Returns the content of the response as a string.
Returns:
Returns the content of the response as an XML document.
Returns:
Creates a new form and initialize it from the HTML representation of a form.
Parameters:
strFragment – the html fragment containing a tag.
Throws:
an error if the fragment was not well-formed or did not contain a form tag.
Returns:
void promptForFile(strFieldName
: String)
Invokes the operating system file browser to choose a file for a file upload field. This method is not
supported in browsers other than Microsoft Internet Explorer.
Parameters:
strFieldName – the name of the file upload field.
void removeField(strName
: String)
Removes a field from this form.
Parameters:
strName – the name of the form field to remove.
Reveals the IFRAME containing this form for debugging purposes. Dimensions of the revealed form may be provided
or a default position and dimensions will be used.
Parameters:
l – pixels from the left side of the HTML page that the IFRAME will be displayed.
t – pixels from the top of the HTML page that the IFRAME will be displayed.
w – width of the revealed IFRAME, in pixels.
h – height of the revealed IFRAME, in pixels.
Since:
3.2
See Also:
void send(intPollInterval
: int, intTimeout
: int)
Sends the form. Sending the form is always asynchronous. Once a form has been sent it may not be reused.
Parameters:
intPollInterval – milliseconds between checking for a response. If not provided, the default value is 1/4 sec.
intTimeout – total milliseconds before timeout. If not provided, the default value is 30 sec.
void send(intPollInterval
: int, intTimeout
: int)
Sends the form. Sending the form is always asynchronous. Once a form has been sent it may not be reused.
Parameters:
intPollInterval – milliseconds between checking for a response. If not provided, the default value is 1/4 sec.
intTimeout – total milliseconds before timeout. If not provided, the default value is 30 sec.
void setAction(action
: String)
Sets the action of this form.
Parameters:
Sets the value of a field in this form.
Parameters:
strName – the name of the form field to set.
strValue – the new value of form field.
bConcat – if true, will append " " + strValue to the existing value. The space is
only inserted if the existing value is not empty.
void setMethod(method
: String)
Sets the method of this form.
Parameters:
method – METHOD_GET or METHOD_POST.
void setMultipart(multipart
: boolean)
Sets whether this form is multipart.
Parameters:
Copyright © 2001-2007, TIBCO Software Inc.