java.lang.Object | |||||
↳ | com.google.gwt.user.client.ui.UIObject | ||||
↳ | com.google.gwt.user.client.ui.Widget | ||||
↳ | com.google.gwt.user.client.ui.Panel | ||||
↳ | com.google.gwt.user.client.ui.SimplePanel | ||||
↳ | com.google.gwt.user.client.ui.FormPanel |
A panel that wraps its contents in an HTML <FORM> element.
This panel can be used to achieve interoperability with servers that accept
traditional HTML form encoding. The following widgets (those that implement
HasName
) will be submitted to the
server if they are contained within this panel:
TextBox
PasswordTextBox
RadioButton
SimpleRadioButton
CheckBox
SimpleCheckBox
TextArea
ListBox
FileUpload
Hidden
FileUpload
is
only useful when used within a FormPanel, because the browser will
only upload files using form submission.
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
FormPanel.SubmitCompleteEvent | Fired when a form has been submitted successfully. | ||||||||||
FormPanel.SubmitCompleteHandler | Handler for FormPanel.SubmitCompleteEvent events. |
||||||||||
FormPanel.SubmitEvent | Fired when the form is submitted. | ||||||||||
FormPanel.SubmitHandler | Handler for FormPanel.SubmitEvent events. |
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
String | ENCODING_MULTIPART | Used with setEncoding(String) to specify that the form will be
submitted using MIME encoding (necessary for FileUpload to work
properly). |
|||||||||
String | ENCODING_URLENCODED | Used with setEncoding(String) to specify that the form will be
submitted using traditional URL encoding. |
|||||||||
String | METHOD_GET | Used with setMethod(String) to specify that the form will be
submitted using an HTTP GET request. |
|||||||||
String | METHOD_POST | Used with setMethod(String) to specify that the form will be
submitted using an HTTP POST request (necessary for FileUpload to
work properly). |
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
com.google.gwt.user.client.ui.UIObject
|
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Creates a new FormPanel.
| |||||||||||
Creates a FormPanel that targets a
NamedFrame . | |||||||||||
Creates a new FormPanel.
|
Protected Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
This constructor may be used by subclasses to explicitly use an existing
element.
| |||||||||||
This constructor may be used by subclasses to explicitly use an existing
element.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
This method is deprecated.
Use
addSubmitCompleteHandler(FormPanel.SubmitCompleteHandler) and
addSubmitHandler(FormPanel.SubmitHandler) instead
| |||||||||||
Adds a
FormPanel.SubmitCompleteEvent handler. | |||||||||||
Adds a
FormPanel.SubmitEvent handler. | |||||||||||
Gets the 'action' associated with this form.
| |||||||||||
Gets the encoding used for submitting this form.
| |||||||||||
Gets the HTTP method used for submitting this form.
| |||||||||||
Gets the form's 'target'.
| |||||||||||
Fired when a form is submitted.
| |||||||||||
Called when the target frame is done loading.
| |||||||||||
This method is deprecated.
Use the
removeHandler() method on the
object returned by and add*Handler method instead
| |||||||||||
Resets the form, clearing all fields.
| |||||||||||
Sets the 'action' associated with this form.
| |||||||||||
Sets the encoding used for submitting this form.
| |||||||||||
Sets the HTTP method used for submitting this form.
| |||||||||||
Submits the form.
| |||||||||||
Creates a FormPanel that wraps an existing <form> element.
| |||||||||||
Creates a FormPanel that wraps an existing <form> element.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
This method is called when a widget is attached to the browser's document. | |||||||||||
This method is called when a widget is detached from the browser's document. |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
com.google.gwt.user.client.ui.SimplePanel
| |||||||||||
From class
com.google.gwt.user.client.ui.Panel
| |||||||||||
From class
com.google.gwt.user.client.ui.Widget
| |||||||||||
From class
com.google.gwt.user.client.ui.UIObject
| |||||||||||
From class
java.lang.Object
| |||||||||||
From interface com.google.gwt.event.logical.shared.HasAttachHandlers | |||||||||||
From interface com.google.gwt.event.shared.HasHandlers | |||||||||||
From interface
com.google.gwt.user.client.EventListener
| |||||||||||
From interface
com.google.gwt.user.client.ui.AcceptsOneWidget
| |||||||||||
From interface
com.google.gwt.user.client.ui.FiresFormEvents
| |||||||||||
From interface
com.google.gwt.user.client.ui.HasOneWidget
| |||||||||||
From interface
com.google.gwt.user.client.ui.HasWidgets
| |||||||||||
From interface
com.google.gwt.user.client.ui.HasWidgets.ForIsWidget
| |||||||||||
From interface
com.google.gwt.user.client.ui.IsWidget
| |||||||||||
From interface
com.google.gwt.user.client.ui.impl.FormPanelImplHost
| |||||||||||
From interface
java.lang.Iterable
|
Used with setEncoding(String)
to specify that the form will be
submitted using MIME encoding (necessary for FileUpload
to work
properly).
Used with setEncoding(String)
to specify that the form will be
submitted using traditional URL encoding.
Used with setMethod(String)
to specify that the form will be
submitted using an HTTP GET request.
Used with setMethod(String)
to specify that the form will be
submitted using an HTTP POST request (necessary for FileUpload
to
work properly).
Creates a new FormPanel. When created using this constructor, it will be
submitted to a hidden <iframe> element, and the results of the
submission made available via FormPanel.SubmitCompleteHandler
.
The back-end server is expected to respond with a content-type of
'text/html', meaning that the text returned will be treated as HTML. If any
other content-type is specified by the server, then the result HTML sent in
the onFormSubmit event will be unpredictable across browsers, and the
onSubmitComplete
event may not fire at all.
Creates a FormPanel that targets a NamedFrame
. The target frame is
not physically attached to the form, and must therefore still be added to a
panel elsewhere.
When the FormPanel targets an external frame in this way, it will not fire the FormSubmitComplete event.
frameTarget | the NamedFrame to be targetted
|
---|
Creates a new FormPanel. When created using this constructor, it will be submitted either by replacing the current page, or to the named <iframe>.
When the FormPanel targets an external frame in this way, it will not fire the FormSubmitComplete event.
target | the name of the <iframe> to receive the results of the
submission, or null to specify that the current page
be replaced
|
---|
This constructor may be used by subclasses to explicitly use an existing element. This element must be a <form> element.
The specified form element's target attribute will not be set, and the
FormSubmitCompleteEvent
will not be fired.
element | the element to be used |
---|
This constructor may be used by subclasses to explicitly use an existing element. This element must be a <form> element.
If the createIFrame parameter is set to true
, then the wrapped
form's target attribute will be set to a hidden iframe. If not, the form's
target will be left alone, and the FormSubmitComplete event will not be
fired.
element | the element to be used |
---|---|
createIFrame | true to create an <iframe> element
that will be targeted by this form
|
This method is deprecated.
Use addSubmitCompleteHandler(FormPanel.SubmitCompleteHandler)
and
addSubmitHandler(FormPanel.SubmitHandler)
instead
Adds a handler interface to receive click events.
handler | the handler interface to add |
---|
Adds a FormPanel.SubmitCompleteEvent
handler.
handler | the handler |
---|
Adds a FormPanel.SubmitEvent
handler.
handler | the handler |
---|
Gets the 'action' associated with this form. This is the URL to which it will be submitted.
Gets the encoding used for submitting this form. This should be either
ENCODING_MULTIPART
or ENCODING_URLENCODED
.
Gets the HTTP method used for submitting this form. This should be either
METHOD_GET
or METHOD_POST
.
Gets the form's 'target'. This is the name of the NamedFrame
that
will receive the results of submission, or null
if none has
been specified.
Fired when a form is submitted.
Called when the target frame is done loading.
This method is deprecated.
Use the removeHandler()
method on the
object returned by and add*Handler method instead
Removes a previously added handler interface.
handler | the handler interface to remove |
---|
Resets the form, clearing all fields.
Sets the 'action' associated with this form. This is the URL to which it will be submitted.
url | the form's action |
---|
Sets the encoding used for submitting this form. This should be either
ENCODING_MULTIPART
or ENCODING_URLENCODED
.
encodingType | the form's encoding |
---|
Sets the HTTP method used for submitting this form. This should be either
METHOD_GET
or METHOD_POST
.
method | the form's method |
---|
Submits the form.
The FormPanel must not be detached (i.e. removed from its parent
or otherwise disconnected from a RootPanel
) until the submission is
complete. Otherwise, notification of submission will fail.
Creates a FormPanel that wraps an existing <form> element.
This element must already be attached to the document. If the element is
removed from the document, you must call
detachNow(Widget)
.
If the createIFrame parameter is set to true
, then the wrapped
form's target attribute will be set to a hidden iframe. If not, the form's
target will be left alone, and the FormSubmitComplete event will not be
fired.
element | the element to be wrapped |
---|---|
createIFrame | true to create an <iframe> element
that will be targeted by this form
|
Creates a FormPanel that wraps an existing <form> element.
This element must already be attached to the document. If the element is
removed from the document, you must call
detachNow(Widget)
.
The specified form element's target attribute will not be set, and the
FormSubmitCompleteEvent
will not be fired.
element | the element to be wrapped |
---|
This method is called when a widget is attached to the browser's document.
To receive notification after a Widget has been added to the document,
override the onLoad()
method or use addAttachHandler(AttachEvent.Handler)
.
It is strongly recommended that you override onLoad()
or
doAttachChildren()
instead of this method to avoid inconsistencies
between logical and physical attachment states.
Subclasses that override this method must call
super.onAttach()
to ensure that the Widget has been attached
to its underlying Element.
This method is called when a widget is detached from the browser's
document. To receive notification before a Widget is removed from the
document, override the onUnload()
method or use addAttachHandler(AttachEvent.Handler)
.
It is strongly recommended that you override onUnload()
or
doDetachChildren()
instead of this method to avoid inconsistencies
between logical and physical attachment states.
Subclasses that override this method must call
super.onDetach()
to ensure that the Widget has been detached
from the underlying Element. Failure to do so will result in application
memory leaks due to circular references between DOM Elements and JavaScript
objects.