er.extensions.components._private
Class ERXWOForm
java.lang.Object
com.webobjects.appserver.WOElement
com.webobjects.appserver.WODynamicElement
com.webobjects.appserver._private.WODynamicGroup
com.webobjects.appserver._private.WOHTMLDynamicElement
er.extensions.components._private.ERXWOForm
public class ERXWOForm
- extends com.webobjects.appserver._private.WOHTMLDynamicElement
Transparent replacement for WOForm. You don't really need to do anything to
use it, because it will get used instead of WOForm elements automagically. In
addition, it has a few new features:
- it adds the FORM's name to the ERXWOContext's mutableUserInfo as as
"formName" key, which makes writing JavaScript elements a bit easier.
- it warns you when you have one FORM embedded inside another and ommits
the tags for the nested FORM.
- it pushes the
enctype
into the userInfo, so that
ERXWOFileUpload
can check if it is set correctly. ERXFileUpload will
throw an exception if the enctype is not set.
- it has a "fragmentIdentifier" binding, which appends "#" + the value of
the binding to the action. The obvious case comes when you have a form at the
bottom of the page and want to jump to the error messages if there are any.
- it adds the
secure
boolean binding that rewrites the URL
to use https
.
- it adds the
disabled
boolean binding allows you to omit
the form tag.
- it adds a default submit button at the start of the form, so that your
user can simply press return without and javascript gimmicks.
- the
id binding can override the name
binding.
This subclass is installed when the frameworks loads.
If you actually want to see those new bindings in WOBuilder, edit the file
WebObjects Builder.app/Contents/Resources/WebObjectDefinitions.xml
,
which contains the .api for the dynamic elements.
- Author:
- ak, Mike Schrag (idea to secure binding)
Bindings |
action | Action method to invoke when this element is activated. |
actionClass | The name of the class in which the method
designated in directActionName can be found. Defaults to
DirectAction . |
addDefaultSubmitButton | Injects a submit button at the beginning of the
form since some browsers will submit the form using the first nested button
when the return key is pressed. Default is false unless it is set to true in
the properties file. |
directActionName | The name of the direct action method
(minus the "Action" suffix) to invoke when this element is activated.
Defaults to default . |
disabled | Disabling a form omits the form element's tags from the
generated html. ERXWOForm will automatically disable any nested forms and post
a warning to the console if this value is not set. |
enctype | The encoding type of the form. If a form has a file upload
and this is not set to multipart/form-data then an exception is
thrown. |
fragmentIdentifier | appends "#" + the value of the binding to the
action. |
href | The HTML href attribute |
id | The HTML id attribute |
method | The HTTP method used by the form. It can be get
or post |
multipleSubmit | If multipleSubmit evaluates to true , the form can
have more than one submit button, each with its own action. By default, the
value is false unless it is set to true in the properties file. |
name | The HTML name attribute |
queryDictionary | Takes a dictionary of values that will be submitted
with the form. |
secure | Determines if the form is secured with SSL. Default is false. |
embedded | when true, a form inside of a form will still render. this is
to support forms inside of ajax modal containers that are structually nested
forms, but appears as independent to the end-user |
Properties |
er.extensions.ERXWOForm.multipleSubmitDefault | the default value of
multipleSubmit for all forms |
er.extensions.ERXWOForm.addDefaultSubmitButtonDefault | whether or
not a default submit button should be add to the form |
er.extensions.ERXWOForm.useIdInsteadOfNameTag | whether or not to use
id instead of name in the form element |
Fields inherited from class com.webobjects.appserver._private.WOHTMLDynamicElement |
_associations, _constantAttributesRepresentation, _dyneltName, _finishedInitialization |
Fields inherited from class com.webobjects.appserver._private.WODynamicGroup |
_children |
Fields inherited from class com.webobjects.appserver.WODynamicElement |
_ConstructorParameters |
Constructor Summary |
ERXWOForm(java.lang.String name,
com.webobjects.foundation.NSDictionary associations,
com.webobjects.appserver.WOElement element)
|
Method Summary |
protected void |
_appendHiddenFieldsToResponse(com.webobjects.appserver.WOResponse response,
com.webobjects.appserver.WOContext context)
|
protected void |
_clearEnctype()
|
protected void |
_clearFormName(com.webobjects.appserver.WOContext context,
java.lang.String previousFormName,
boolean wasInForm)
|
protected boolean |
_disabled(com.webobjects.appserver.WOContext context)
|
protected java.lang.String |
_enctype(com.webobjects.appserver.WOContext context)
|
protected boolean |
_enterFormInContext(com.webobjects.appserver.WOContext context)
|
protected void |
_exitFormInContext(com.webobjects.appserver.WOContext context,
boolean wasInForm,
boolean wasFormSubmitted)
|
protected java.lang.String |
_formName(com.webobjects.appserver.WOContext context)
|
protected void |
_setEnctype(java.lang.String enctype)
|
protected java.lang.String |
_setFormName(com.webobjects.appserver.WOContext context,
boolean wasInForm)
|
protected boolean |
_shouldAppendFormTags(com.webobjects.appserver.WOContext context,
boolean wasInForm)
|
void |
appendAttributesToResponse(com.webobjects.appserver.WOResponse response,
com.webobjects.appserver.WOContext context)
|
void |
appendChildrenToResponse(com.webobjects.appserver.WOResponse response,
com.webobjects.appserver.WOContext context)
|
void |
appendToResponse(com.webobjects.appserver.WOResponse response,
com.webobjects.appserver.WOContext context)
|
protected java.lang.String |
cgiAction(com.webobjects.appserver.WOResponse response,
com.webobjects.appserver.WOContext context,
boolean secure)
|
static java.lang.String |
formName(com.webobjects.appserver.WOContext context,
java.lang.String defaultName)
Retrieves the current FORM's name in the supplied context. |
com.webobjects.appserver.WOActionResults |
invokeAction(com.webobjects.appserver.WORequest worequest,
com.webobjects.appserver.WOContext context)
|
void |
takeValuesFromRequest(com.webobjects.appserver.WORequest request,
com.webobjects.appserver.WOContext context)
|
java.lang.String |
toString()
|
Methods inherited from class com.webobjects.appserver._private.WOHTMLDynamicElement |
_appendAttributesFromAssociationsToResponse, _appendCloseTagToResponse, _appendOpenTagToResponse, _frameworkNameInComponent, appendConstantAttributesToResponse, appendNonURLAttributesToResponse, appendURLAttributesToResponse, computeActionStringInContext, computeQueryDictionaryInContext, constantAttributesRepresentation, elementName, escapeHTML, nonUrlAttributeAssociations, urlAttributeAssociations |
Methods inherited from class com.webobjects.appserver._private.WODynamicGroup |
addChildElement, childrenElements, EmptyGroup, hasChildrenElements, invokeChildrenAction, takeChildrenValuesFromRequest |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
_action
protected com.webobjects.appserver.WOAssociation _action
_href
protected com.webobjects.appserver.WOAssociation _href
_multipleSubmit
protected com.webobjects.appserver.WOAssociation _multipleSubmit
_actionClass
protected com.webobjects.appserver.WOAssociation _actionClass
_queryDictionary
protected com.webobjects.appserver.WOAssociation _queryDictionary
_otherQueryAssociations
protected com.webobjects.foundation.NSDictionary _otherQueryAssociations
_directActionName
protected com.webobjects.appserver.WOAssociation _directActionName
_addDefaultSubmitButton
protected com.webobjects.appserver.WOAssociation _addDefaultSubmitButton
_embedded
protected com.webobjects.appserver.WOAssociation _embedded
multipleSubmitDefault
public static boolean multipleSubmitDefault
addDefaultSubmitButtonDefault
public static boolean addDefaultSubmitButtonDefault
useIdInsteadOfNameTag
public static boolean useIdInsteadOfNameTag
ERXWOForm
public ERXWOForm(java.lang.String name,
com.webobjects.foundation.NSDictionary associations,
com.webobjects.appserver.WOElement element)
toString
public java.lang.String toString()
- Overrides:
toString
in class com.webobjects.appserver._private.WOHTMLDynamicElement
_enterFormInContext
protected boolean _enterFormInContext(com.webobjects.appserver.WOContext context)
_exitFormInContext
protected void _exitFormInContext(com.webobjects.appserver.WOContext context,
boolean wasInForm,
boolean wasFormSubmitted)
_enctype
protected java.lang.String _enctype(com.webobjects.appserver.WOContext context)
_setEnctype
protected void _setEnctype(java.lang.String enctype)
_clearEnctype
protected void _clearEnctype()
invokeAction
public com.webobjects.appserver.WOActionResults invokeAction(com.webobjects.appserver.WORequest worequest,
com.webobjects.appserver.WOContext context)
- Overrides:
invokeAction
in class com.webobjects.appserver._private.WODynamicGroup
_appendHiddenFieldsToResponse
protected void _appendHiddenFieldsToResponse(com.webobjects.appserver.WOResponse response,
com.webobjects.appserver.WOContext context)
appendChildrenToResponse
public void appendChildrenToResponse(com.webobjects.appserver.WOResponse response,
com.webobjects.appserver.WOContext context)
- Overrides:
appendChildrenToResponse
in class com.webobjects.appserver._private.WODynamicGroup
cgiAction
protected java.lang.String cgiAction(com.webobjects.appserver.WOResponse response,
com.webobjects.appserver.WOContext context,
boolean secure)
takeValuesFromRequest
public void takeValuesFromRequest(com.webobjects.appserver.WORequest request,
com.webobjects.appserver.WOContext context)
- Overrides:
takeValuesFromRequest
in class com.webobjects.appserver._private.WODynamicGroup
_formName
protected java.lang.String _formName(com.webobjects.appserver.WOContext context)
_disabled
protected boolean _disabled(com.webobjects.appserver.WOContext context)
_shouldAppendFormTags
protected boolean _shouldAppendFormTags(com.webobjects.appserver.WOContext context,
boolean wasInForm)
_setFormName
protected java.lang.String _setFormName(com.webobjects.appserver.WOContext context,
boolean wasInForm)
_clearFormName
protected void _clearFormName(com.webobjects.appserver.WOContext context,
java.lang.String previousFormName,
boolean wasInForm)
appendAttributesToResponse
public void appendAttributesToResponse(com.webobjects.appserver.WOResponse response,
com.webobjects.appserver.WOContext context)
- Overrides:
appendAttributesToResponse
in class com.webobjects.appserver._private.WOHTMLDynamicElement
appendToResponse
public void appendToResponse(com.webobjects.appserver.WOResponse response,
com.webobjects.appserver.WOContext context)
- Overrides:
appendToResponse
in class com.webobjects.appserver._private.WOHTMLDynamicElement
formName
public static java.lang.String formName(com.webobjects.appserver.WOContext context,
java.lang.String defaultName)
- Retrieves the current FORM's name in the supplied context. If none is set
(either the FORM is not a ERXWOForm or the context is not
ERXMutableUserInfo) the supplied default value is used.
- Parameters:
context
- current contextdefaultName
- default name to use
- Returns:
- form name in context or default value
Copyright © 2002 – 2007 Project Wonder.