Author: ivaynberg
Date: Tue Jun 28 22:16:35 2011
New Revision: 1140868
URL: http://svn.apache.org/viewvc?rev=1140868&view=rev
Log:
Issue: WICKET-3840
Modified:
wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/ajax/form/AjaxFormSubmitBehavior.java
wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxSubmitLink.java
Modified:
wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/ajax/form/AjaxFormSubmitBehavior.java
URL:
http://svn.apache.org/viewvc/wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/ajax/form/AjaxFormSubmitBehavior.java?rev=1140868&r1=1140867&r2=1140868&view=diff
==============================================================================
---
wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/ajax/form/AjaxFormSubmitBehavior.java
(original)
+++
wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/ajax/form/AjaxFormSubmitBehavior.java
Tue Jun 28 22:16:35 2011
@@ -84,9 +84,7 @@ public abstract class AjaxFormSubmitBeha
{
if (__form == null)
{
- // try to find form in the hierarchy of owning component
- Component component = getComponent();
- __form = component.findParent(Form.class);
+ __form = findForm();
if (__form == null)
{
throw new IllegalStateException(
@@ -99,6 +97,18 @@ public abstract class AjaxFormSubmitBeha
}
/**
+ * Finds the form this behavior is linked to
+ *
+ * @return form this behavior is linked to or {@code null} if none
+ */
+ protected Form<?> findForm()
+ {
+ // try to find form in the hierarchy of owning component
+ Component component = getComponent();
+ return component.findParent(Form.class);
+ }
+
+ /**
*
* @see org.apache.wicket.ajax.AjaxEventBehavior#getEventHandler()
*/
@@ -109,7 +119,10 @@ public abstract class AjaxFormSubmitBeha
final CharSequence url = getCallbackUrl();
AppendingStringBuffer call = new
AppendingStringBuffer("wicketSubmitFormById('").append(
- formId).append("', '").append(url).append("', ");
+ formId)
+ .append("', '")
+ .append(url)
+ .append("', ");
if (getComponent() instanceof IFormSubmittingComponent)
{
Modified:
wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxSubmitLink.java
URL:
http://svn.apache.org/viewvc/wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxSubmitLink.java?rev=1140868&r1=1140867&r2=1140868&view=diff
==============================================================================
---
wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxSubmitLink.java
(original)
+++
wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxSubmitLink.java
Tue Jun 28 22:16:35 2011
@@ -87,6 +87,12 @@ public abstract class AjaxSubmitLink ext
}
@Override
+ protected Form<?> findForm()
+ {
+ return AjaxSubmitLink.this.getForm();
+ }
+
+ @Override
protected void onComponentTag(ComponentTag tag)
{
// write the onclick handler only if link is
enabled