You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Andy Pahne <ap...@net22.de> on 2008/08/29 14:14:28 UTC

[T5]: using a mixin on a form prevents correct submission

I have a very simple page which uses a form to update one page property 
and a zone. Sourcecode and template see below.

It works as expected, the page property and the zone is updated as intended.

But whenever I use a the FormLayoutMixin on the form, "somePageProperty" 
won't be updated anymore. The mixin doesn't do very much but render some 
html before and some after the form, so I don't understand this odd 
behaviour.

I tested this with 5.0.14 and 5.0.15-SNAPSHOT on Windows XP with Jetty 6 
and FF3.

Andy



----------------------------------
*     page class                 *
----------------------------------
public class FormZoneUpdate {

     @Inject
     private Block showResult;

     @Property
     private String somePageProperty;

     /**Tapestry form submit event method. Called if validation is 
successful.*/
     @Log
     public Object onSuccess() {
         return showResult;
     }

}


----------------------------------
*     page template              *
----------------------------------
<html t:type="t5c/LeoniLayout"
       t:pageTitle="literal:Example: Form Updating Zone "
       xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">


     <form t:type="Form"
           t:autofocus="true"
           t:zone="resultZone"
           t:mixins="t5c/FormLayoutMixin"
           t:layoutMixinTitle="boo">
         <tr>
             <td class="formFieldLabel" valign="top" align="right">
                 <t:label for="searchTerm"/>
             </td>
             <td class="formField">
                 <input t:type="TextField"
                        t:value="somePageProperty"
                        t:id="searchTerm"/>
             </td>
         </tr>
          <tr>
              <td class="formButtons" colspan="2">
                       <input t:type="submit"
                              t:clientId="Submit"
                              t:id="submitButton"
                              value="Submit"/>
              </td>
          </tr>
     </form>


     <t:zone t:id="resultZone">
          Nothing yet to show.
          <t:block id="showResult">
             You searched for: ${somePageProperty}
         </t:block>
     </t:zone>

</html>





----------------------------------
*     mixin class                *
----------------------------------

@IncludeStylesheet("css/FormLayoutMixin.css")
public class FormLayoutMixin {

     /**
      * Der Titel des Formulars
      */
     @Parameter(required=true, allowNull=false, 
defaultPrefix=BindingConstants.LITERAL)
     private String layoutMixinTitle;

     void beginRender(MarkupWriter writer) {
         writer.writeRaw("<table class=\"t5c-form 
t5c-oneColumnStyle\"><tr><th>");
         writer.writeRaw(getLayoutMixinTitle());
         writer.writeRaw("</th></tr><tr><td><table><tr><td>");
     }

     void afterRender(MarkupWriter writer) {
         writer.writeRaw("</td></tr></table></td></tr></table>");
     }


     /**
      * @return the layoutMixinTitle
      */
     public String getLayoutMixinTitle() {
         return this.layoutMixinTitle;
     }
}






---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: [T5]: using a mixin on a form prevents correct submission

Posted by Andy Pahne <ap...@net22.de>.
some ,ore testing revealed that BeanEditForm works very well with the 
FormLayoutMixin, but Form does not.




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: [T5]: using a mixin on a form prevents correct submission

Posted by Andy Pahne <ap...@net22.de>.
The same happens if I wrap another component around the form.

In this example "t5c/ContentBox" is nothing more than a component 
wrapping a table around it's body and including some CSS.

"somePageProperty" will not be updated with the ContentBox
component.


...
  <span t:type="t5c/ContentBox" title="boo">
     <form t:type="Form"
           t:autofocus="true"
           t:zone="resultZone">

         <tr>
             <td class="formFieldLabel" valign="top" align="right">
                 <t:label for="searchTerm"/>
             </td>
             <td class="formField">
                 <input t:type="TextField"
                        t:value="somePageProperty"
                        t:id="searchTerm"/>
             </td>
         </tr>
          <tr>
              <td class="formButtons" colspan="2">
                       <input t:type="submit"
                              t:clientId="Submit"
                              t:id="submitButton"
                              value="Submit"/>
              </td>
          </tr>
     </form>

</span>
....

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org