Project Wonder 5.0

er.ajax
Class AjaxObserveField

java.lang.Object
  extended by com.webobjects.appserver.WOElement
      extended by com.webobjects.appserver.WODynamicElement
          extended by com.webobjects.appserver._private.WODynamicGroup
              extended by er.ajax.AjaxDynamicElement
                  extended by er.ajax.AjaxObserveField
All Implemented Interfaces:
IAjaxElement

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 leave of 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.

Bindings
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 befor the Ajax request is sent to the server. Useful e.g. if you want to disable the form while the ajax request is running.
           

Field Summary
 
Fields inherited from class er.ajax.AjaxDynamicElement
log
 
Fields inherited from class com.webobjects.appserver.WODynamicElement
_ConstructorParameters
 
Constructor Summary
AjaxObserveField(java.lang.String name, com.webobjects.foundation.NSDictionary associations, com.webobjects.appserver.WOElement children)
           
 
Method Summary
protected  void addRequiredWebResources(com.webobjects.appserver.WOResponse response, com.webobjects.appserver.WOContext context)
          Adds all required resources.
 void appendToResponse(com.webobjects.appserver.WOResponse response, com.webobjects.appserver.WOContext context)
          Overridden to call AjaxDynamicElement.addRequiredWebResources(WOResponse, WOContext).
static void appendToResponse(com.webobjects.appserver.WOResponse response, com.webobjects.appserver.WOContext context, AjaxDynamicElement element, java.lang.String observeFieldID, boolean observeDescendentFields, java.lang.String updateContainerID, boolean fullSubmit, com.webobjects.foundation.NSMutableDictionary options)
           
 com.webobjects.foundation.NSMutableDictionary createAjaxOptions(com.webobjects.appserver.WOComponent component)
           
 com.webobjects.appserver.WOActionResults handleRequest(com.webobjects.appserver.WORequest request, com.webobjects.appserver.WOContext context)
          Override this method to return the response for an Ajax request.
 com.webobjects.appserver.WOActionResults invokeAction(com.webobjects.appserver.WORequest worequest, com.webobjects.appserver.WOContext wocontext)
          Execute the request, if it's comming from our action, then invoke the ajax handler and put the key AJAX_REQUEST_KEY in the request userInfo dictionary (request.userInfo()).
static java.lang.String nameInContext(com.webobjects.appserver.WOContext context, com.webobjects.appserver.WOComponent component, AjaxDynamicElement element)
           
 
Methods inherited from class er.ajax.AjaxDynamicElement
_containerID, addScriptResourceInHead, addScriptResourceInHead, addStylesheetResourceInHead, addStylesheetResourceInHead, appendTagAttributeToResponse, associations, bindingNamed, booleanValueForBinding, hasBinding, setValueForBinding, shouldHandleRequest, stringValueForBinding, takeValuesFromRequest, valueForBinding, valueForBinding
 
Methods inherited from class com.webobjects.appserver._private.WODynamicGroup
addChildElement, appendChildrenToResponse, childrenElements, EmptyGroup, hasChildrenElements, invokeChildrenAction, takeChildrenValuesFromRequest, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AjaxObserveField

public AjaxObserveField(java.lang.String name,
                        com.webobjects.foundation.NSDictionary associations,
                        com.webobjects.appserver.WOElement children)
Method Detail

addRequiredWebResources

protected void addRequiredWebResources(com.webobjects.appserver.WOResponse response,
                                       com.webobjects.appserver.WOContext context)
Adds all required resources.

Specified by:
addRequiredWebResources in class AjaxDynamicElement

createAjaxOptions

public com.webobjects.foundation.NSMutableDictionary createAjaxOptions(com.webobjects.appserver.WOComponent component)

appendToResponse

public void appendToResponse(com.webobjects.appserver.WOResponse response,
                             com.webobjects.appserver.WOContext context)
Description copied from class: AjaxDynamicElement
Overridden to call AjaxDynamicElement.addRequiredWebResources(WOResponse, WOContext).

Overrides:
appendToResponse in class AjaxDynamicElement

appendToResponse

public static void appendToResponse(com.webobjects.appserver.WOResponse response,
                                    com.webobjects.appserver.WOContext context,
                                    AjaxDynamicElement element,
                                    java.lang.String observeFieldID,
                                    boolean observeDescendentFields,
                                    java.lang.String updateContainerID,
                                    boolean fullSubmit,
                                    com.webobjects.foundation.NSMutableDictionary options)

nameInContext

public static java.lang.String nameInContext(com.webobjects.appserver.WOContext context,
                                             com.webobjects.appserver.WOComponent component,
                                             AjaxDynamicElement element)

invokeAction

public com.webobjects.appserver.WOActionResults invokeAction(com.webobjects.appserver.WORequest worequest,
                                                             com.webobjects.appserver.WOContext wocontext)
Description copied from class: AjaxDynamicElement
Execute the request, if it's comming from our action, then invoke the ajax handler and put the key AJAX_REQUEST_KEY in the request userInfo dictionary (request.userInfo()).

Overrides:
invokeAction in class AjaxDynamicElement

handleRequest

public com.webobjects.appserver.WOActionResults handleRequest(com.webobjects.appserver.WORequest request,
                                                              com.webobjects.appserver.WOContext context)
Description copied from class: AjaxDynamicElement
Override this method to return the response for an Ajax request.

Specified by:
handleRequest in interface IAjaxElement
Specified by:
handleRequest in class AjaxDynamicElement

Last updated: Tue, Feb 21, 2017 • 05:45 PM CET

Copyright © 2002 – 2007 Project Wonder.