public static void appendToResponse(WOResponse response, WOContext context, AjaxDynamicElement element, String observeFieldID, String updateContainerID, boolean fullSubmit, NSDictionary options) { WOComponent component = context.component();  response.appendContentString("new Form.Element.Observer($('" + observeFieldID + "'), 0, function(element, value) { "); NSMutableDictionary observerOptions = new NSMutableDictionary(); if (options != null) { observerOptions.addEntriesFromDictionary(options);
public void appendToResponse(WOResponse response, WOContext context) { WOComponent component = context.component(); String observeFieldID = (String) valueForBinding("observeFieldID", component); String updateContainerID = (String) valueForBinding("updateContainerID", component); if (observeFieldID != null && updateContainerID != null) { AjaxUtils.appendScriptHeader(response); NSDictionary options = createAjaxOptions(component); Boolean fullSubmitBoolean = (Boolean) valueForBinding("fullSubmit", component); boolean fullSubmit = (fullSubmitBoolean != null && fullSubmitBoolean.booleanValue()); AjaxObserveField.appendToResponse(response, context, this, observeFieldID, updateContainerID, fullSubmit, options); AjaxUtils.appendScriptFooter(response);
	public static void appendToResponse(WOResponse response, WOContext context, AjaxDynamicElement element, String observeFieldID, String updateContainerID, boolean fullSubmit, NSDictionary options) {	    WOComponent component = context.component();		response.appendContentString("new Form.Element.Observer($('" + observeFieldID + "'), 0, function(element, value) { ");		NSMutableDictionary observerOptions = new NSMutableDictionary();		if (options != null) {			observerOptions.addEntriesFromDictionary(options);		}		observerOptions.setObjectForKey("true", "asynchronous");		observerOptions.setObjectForKey("'post'", "method");		if (!fullSubmit) {			// We need to cheat and make the WOForm that contains the form action appear to have been			// submitted. So we grab the action url, pull off the element ID from its action URL			// and pass that in as FORCE_FORM_SUBMITTED_KEY, which is processed by ERXWOForm just like			// senderID is on the real WOForm. Unfortunately we can't hook into the real WOForm to do			// this :(			response.appendContentString("var observedFieldForm = $('" + observeFieldID + "').form;\n");			response.appendContentString("var observedFieldFormAction = observedFieldForm.action;\n");			response.appendContentString("var senderID = observedFieldFormAction.substring(observedFieldFormAction.indexOf('.', observedFieldFormAction.lastIndexOf('/')) + 1);\n");			StringBuffer parameters = new StringBuffer();			parameters.append("escape($('" + observeFieldID + "').name) + '=' + escape($F('" + observeFieldID + "')) + '");			parameters.append("&");			parameters.append(AjaxSubmitButton.KEY_AJAX_SUBMIT_BUTTON_NAME + "=" + nameInContext(context, component, element));			parameters.append("&");			parameters.append(AjaxUtils.FORCE_FORM_SUBMITTED_KEY + "=' + senderID");			observerOptions.setObjectForKey(parameters.toString(), "parameters");			response.appendContentString("new Ajax.Updater('" + updateContainerID + "', $('" + updateContainerID + "').getAttribute('updateUrl'), ");			AjaxOptions.appendToResponse(observerOptions, response, context);			response.appendContentString(");");		}		else {			StringBuffer parameters = new StringBuffer();			parameters.append("Form.serialize($('" + observeFieldID + "').form)");			if (updateContainerID != null) {				parameters.append(" + '&" + AjaxUpdateContainer.UPDATE_CONTAINER_ID_KEY + "=" + updateContainerID + "'");			}			parameters.append(" + '&" + AjaxSubmitButton.KEY_AJAX_SUBMIT_BUTTON_NAME + "=" + nameInContext(context, component, element) + "'");			observerOptions.setObjectForKey(parameters.toString(), "parameters");			String actionUrl = "$('" + observeFieldID + "').form.action";			if (updateContainerID != null) {				response.appendContentString("new Ajax.Updater('" + updateContainerID + "', " + actionUrl + ", ");				AjaxOptions.appendToResponse(observerOptions, response, context);				response.appendContentString(");");			}			else {				response.appendContentString("new Ajax.Request(" + actionUrl + ", ");				AjaxOptions.appendToResponse(observerOptions, response, context);				response.appendContentString(");");			}			response.appendContentString("\n");		}		response.appendContentString(" });");	}