public class AjaxObserveField extends AjaxDynamicElement
AjaxObserveField allows you to perform an Ajax submit (and optional update) based on the state of a form field changing. If you specify an observeFieldID, that single field will be observed for changes. If you also specify an updateContainerID, the given container will be refreshed after the field changes. If you do NOT specify an observeFieldID, all of the form fields contained within this component will be observed for changes instead. The list of form fields to observe is obtained on the client side, so you should not put AjaxUpdateContainers INSIDE of this component or none fields inside of the container will be observed after an update. Instead, AjaxObserveFields should be surrounded by an update container.
If you set an observeFieldID you must place the AjaxObserveField tag after the field you would like to observe.
If you omit the observeFieldID, AjaxObserveField must generate an HTML container, so that it can find the form fields that correspond to this component from the client side, so you will get an extra DOM element when used as a container.
AjaxObserveFields observe specific instances of DOM elements. If you Ajax replace the DOM elements being watched, the observe field will cease to function. To prevent this problem, you should always ensure that any Ajax update of an observed field also updates the AjaxObserveField component as well. The rule of thumb is that all AjaxObserveFields should be in the same AjaxUpdateContainer as the fields they observe.
Name | Description |
---|---|
id | the ID of the observe field container (only useful if you leave off observeFieldID). |
elementName | element to use for the observe field container. Defaults to div .
(Only used if you leave off observeFieldID) |
observeFieldID | the ID of the field to observe |
updateContainerID | the ID of the container to update. Specify "_parent" to use the nearest one. |
action | the action to call when the observer fires |
onBeforeSubmit | called prior to submitting the observed content; return false to deny the submit |
observeFieldFrequency | the polling observe frequency (in seconds) |
observeDelay | the minimum time between submits (in seconds) |
fullSubmit | When false , only the value of the field that changed is sent to the server
(partial submit), when true , the whole form is sent. Defaults to false .
Caution: Partial submit doesn't work correctly if you manually set the name on your inputs. |
class | CSS class to use on the container. (Only used if you leave off observeFieldID) |
style | CSS style to use on the container. (Only used if you leave off observeFieldID) |
onCreate | Takes a JavaScript function which is called after the form has been serialized, but before the Ajax request is sent to the server. Useful e.g. if you want to disable the form while the Ajax request is running. |
ERXDynamicElement.ContextData<T>
log
_children
_ConstructorParameters
Constructor and Description |
---|
AjaxObserveField(String name,
NSDictionary<String,WOAssociation> associations,
WOElement children) |
Modifier and Type | Method and Description |
---|---|
protected void |
addRequiredWebResources(WOResponse response,
WOContext context)
Override this method to append the needed scripts for this component.
|
void |
appendToResponse(WOResponse response,
WOContext context)
Overridden to call
AjaxDynamicElement.addRequiredWebResources(WOResponse, WOContext) . |
static void |
appendToResponse(WOResponse response,
WOContext context,
AjaxDynamicElement element,
String observeFieldID,
boolean observeDescendentFields,
String updateContainerID,
boolean fullSubmit,
NSMutableDictionary<String,String> options) |
NSMutableDictionary<String,String> |
createAjaxOptions(WOComponent component) |
WOActionResults |
handleRequest(WORequest request,
WOContext context)
Override this method to return the response for an Ajax request.
|
WOActionResults |
invokeAction(WORequest request,
WOContext context)
Execute the request, if it's coming from our action, then invoke the ajax handler and put the key
AJAX_REQUEST_KEY in the request userInfo dictionary (request.userInfo() ). |
static String |
nameInContext(WOContext context,
WOComponent component,
AjaxDynamicElement element) |
_containerID, addScriptResourceInHead, addScriptResourceInHead, addStylesheetResourceInHead, addStylesheetResourceInHead, shouldHandleRequest
afterProcessing, appendTagAttributeToResponse, arrayValueForBinding, arrayValueForBinding, associations, beforeProcessing, bindingIsSettable, bindingNamed, booleanValueForBinding, booleanValueForBinding, hasBinding, id, integerValueForBinding, nameInContext, secureInContext, setValueForBinding, stringValueForBinding, stringValueForBinding, valueForBinding, valueForBinding
addChildElement, appendChildrenToResponse, childrenElements, EmptyGroup, hasChildrenElements, invokeChildrenAction, takeChildrenValuesFromRequest, takeValuesFromRequest, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
valueForBinding, valueForBinding
public AjaxObserveField(String name, NSDictionary<String,WOAssociation> associations, WOElement children)
protected void addRequiredWebResources(WOResponse response, WOContext context)
AjaxDynamicElement
addRequiredWebResources
in class AjaxDynamicElement
response
- the current responsecontext
- context of the transactionpublic NSMutableDictionary<String,String> createAjaxOptions(WOComponent component)
public void appendToResponse(WOResponse response, WOContext context)
AjaxDynamicElement
AjaxDynamicElement.addRequiredWebResources(WOResponse, WOContext)
.appendToResponse
in class AjaxDynamicElement
response
- the current responsecontext
- context of the transactionpublic static void appendToResponse(WOResponse response, WOContext context, AjaxDynamicElement element, String observeFieldID, boolean observeDescendentFields, String updateContainerID, boolean fullSubmit, NSMutableDictionary<String,String> options)
public static String nameInContext(WOContext context, WOComponent component, AjaxDynamicElement element)
public WOActionResults invokeAction(WORequest request, WOContext context)
AjaxDynamicElement
AJAX_REQUEST_KEY
in the request userInfo dictionary (request.userInfo()
).invokeAction
in class AjaxDynamicElement
request
- the current requestcontext
- context of the transactionpublic WOActionResults handleRequest(WORequest request, WOContext context)
AjaxDynamicElement
handleRequest
in interface IAjaxElement
handleRequest
in class AjaxDynamicElement
request
- the current requestcontext
- context of the transactionCopyright © 2002 – 2024 Project Wonder.