params.put(getFieldId(context, component, EVENT_TYPE_PARAM), new JSReference(EVENT_TYPE_PARAM));
params.put(getFieldId(context, component, VIEW_PARAM), new JSReference(VIEW_PARAM));
String clientId = component.getClientId();
params.put(clientId, clientId);
if (isAjaxMode(component)) {
AjaxFunction ajaxFunction = AjaxRendererUtils.buildAjaxFunction(context, component);
ajaxFunction.getOptions().getParameters().putAll(params);
ajaxFunction.getOptions().set("complete", new JSReference(CALLBACK));
jsFunction = ajaxFunction;
} else if (SwitchType.server.equals(component.getSwitchType())) {
jsFunction = new JSFunction("RichFaces.submitForm", "#"
+ RendererUtils.getInstance().getNestingForm(component).getClientId(context),
params,