Hi Arvid,
setDefaultAction: function(defaultActionId) {
var field = Tobago.element(Tobago.page.id + Tobago.SUB_COMPONENT_SEP
+ "form-action");
if (field) {
field.value = defaultActionId;
}
}
could be simplified to
setDefaultAction: function(defaultActionId) {
Tobago.action.value = defaultActionId;
}
Regards,
Volker
2007/11/29, [EMAIL PROTECTED] <[EMAIL PROTECTED]>:
> Author: idus
> Date: Thu Nov 29 10:21:35 2007
> New Revision: 599532
>
> URL: http://svn.apache.org/viewvc?rev=599532&view=rev
> Log:
> TOBAGO-561: ensure that correct default button is active after Ajax request
>
> Modified:
>
> myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ButtonRenderer.java
>
> myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js
>
> Modified:
> myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ButtonRenderer.java
> URL:
> http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ButtonRenderer.java?rev=599532&r1=599531&r2=599532&view=diff
> ==============================================================================
> ---
> myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ButtonRenderer.java
> (original)
> +++
> myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ButtonRenderer.java
> Thu Nov 29 10:21:35 2007
> @@ -54,8 +54,6 @@
> LOG.error("Wrong type: Need " + UICommand.class.getName() + ", but was
> " + component.getClass().getName());
> return;
> }
> -
> -
> }
>
> public void encodeEnd(FacesContext facesContext,
> @@ -95,7 +93,7 @@
>
> String imageName = (String) command.getAttributes().get(ATTR_IMAGE);
> if (imageName != null) {
> - String image = null;
> + String image;
> if (imageName.startsWith("HTTP:") || imageName.startsWith("FTP:")
> || imageName.startsWith("/")) {
> image = imageName;
> @@ -130,6 +128,9 @@
> if (ComponentUtil.getBooleanAttribute(component, ATTR_DEFAULT_COMMAND)) {
> boolean transition = ComponentUtil.getBooleanAttribute(command,
> ATTR_TRANSITION);
> HtmlRendererUtil.setDefaultTransition(facesContext, transition);
> +
> + HtmlRendererUtil.writeScriptLoader(facesContext, null, new String[]{
> + "Tobago.setDefaultAction('" + command.getClientId(facesContext) +
> "')"});
> }
> }
>
>
> Modified:
> myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js
> URL:
> http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js?rev=599532&r1=599531&r2=599532&view=diff
> ==============================================================================
> ---
> myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js
> (original)
> +++
> myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js
> Thu Nov 29 10:21:35 2007
> @@ -1483,8 +1483,14 @@
> }
> }
> return this.browser;
> - }
> + },
>
> + setDefaultAction: function(defaultActionId) {
> + var field = Tobago.element(Tobago.page.id + Tobago.SUB_COMPONENT_SEP +
> "form-action");
> + if (field) {
> + field.value = defaultActionId;
> + }
> + }
> };
>
>
>
>
>