You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Matt Resch <ma...@gmail.com> on 2014/07/31 16:15:39 UTC

HTML comments appearing withing TextArea upon rendering of block [Tapestry 5.3]

Hey all,



I’ve recently been using T 5.3 for an internal site, and have run into a
bit of a snag when using a select component along with a zone and blocks to
conditionally render parts of a form. I’ll include my code below, but first
I’d like to explain what I’m attempting to do, as well as what is going
wrong. Essentially, I populate a t:select component first from a list of
pre-defined values, then using the onValueChangedFrom() method, I get the
value of the currently selected item from t:select in order to
conditionally render the next part of my form. Each item in the select menu
corresponds to a block, which is then displayed within a zone that
corresponds to the t:select component. This all works fine, and is not the
issue that I’m running into. The issue I do have however, is when the value
for select corresponds to a block with a TextArea inside it, html comments
appear within that area. Here is a snippet of code, with (un)important bits
and pieces redacted. The block labeled createBlock is the one with a
TextArea component within it.



Test.java



> @Property
>                 private UploadedFile upload;
>
>                 @Property
>                 private String createCSV;
>
>                 @Property
>                 private List<String> action;
>
>                 @Component
>                 private Form uploadForm;
>
>                 @Inject
>                 private Block editBlock, uploadBlock, createBlock,
> emptyBlock;
>
>                 @InjectComponent
>                 private Zone uploadZone;
>
>                 public Object onActivate(){
>                                 if(!userSession.isAuthenticated())
>                                                 return LoginPage.class;
>                                 action = Arrays.asList("Choose an option",
> "Upload", "Create", "Edit");
>                                 return null;
>                 }
>
> public Object onValueChangedFromAction(String s){
>                                                 if(s.equals("Upload")){
>                                                                 return
> uploadBlock;
>                                                 }else
> if(s.equals("Create")){
>                                                                 return
> createBlock;
>                                                 }else if(s.equals("Edit")){
>                                                                 return
> editBlock;
>                                                 }else
>                                                                 return
> emptyBlock;
>                 }



Test.tml



> <html
>                 t:type="layout"
>                 t:pageName="Test"
>                 t:pageTitle="Test"
>                 xmlns:t="
> http://tapestry.apache.org/schema/tapestry_5_3.xsd">
>
>                 <t:block t:id="emptyBlock">
>                                 <br/>
>                 </t:block>
>
>                 <t:block t:id="createBlock">
>                                                 <table>
>                                                                 <tr>
>
> <td class="name"><b>Write your own .csv here:</b> </td>
>                                                                 </tr>
>                                                                 <tr>
>
> <td><t:TextArea t:id="createCSV" t:value="createCSV" rows="5"
> ></t:TextArea></td>
>                                                                 </tr>
>                                                 </table>
>                 </t:block>
>
>                 <t:block t:id="uploadBlock">
>                                 <t:label for="upload">Upload
> file:</t:label>
>                                 <input t:type="upload" accept="text/csv"
> t:id="upload" t:value="upload" validate="required"/>
>                 </t:block>
>
>
>
>                 <t:form t:id="uploadForm">
>                                 <t:errors/>
>                                                 <t:label
> for="action">Create, edit, or upload .csv?</t:label>
>                                                 <t:select t:id="action"
> model="action" t:zone="uploadZone" t:value="actionSelection"
> t:blankOption="NEVER" validate="required"/>
>                                                                 <t:zone
> t:id="uploadZone" id="uploadZone">
>
> <t:if test="action">
>
> </t:if>
>                                                                 </t:zone>
>                                                 <br/>
>                                 <input type="submit" class="submitbutton"
> value="${message:Test.button.submit}" style="vertical-align:middle;"/>
>                                 &nbsp;
>                                 <t:actionlink t:id="cancel"
> class="cancelbutton">${message:Test.button.cancel}</t:actionlink>
>                 </t:form>
> </html>



Below is an example of the comments that populate the TextArea upon
switching from another block, line 17 refers to this line:


<td><t:TextArea t:id="createCSV" t:value="createCSV"
> rows="5"></t:TextArea></td>




> <!--BEGIN bulkimport/Test:createcsv$renderdisabled
> (context:bulkimport/Test.tml, line 17)--><!--BEGIN
> bulkimport/Test:createcsv$discardbody (context:bulkimport/Test.tml, line
> 17)--><!--END bulkimport/Test:createcsv$discardbody--><!--END
> bulkimport/Test:createcsv$renderdisabled-->
>

Thanks in advance for all the help!



Regards,

Matthew A Resch

Re: HTML comments appearing withing TextArea upon rendering of block [Tapestry 5.3]

Posted by Bob Harner <bo...@gmail.com>.
I think you're seeing Tapestry's rendering comments, which you can turn in
or off.  See the Rendering Comments section of
http://tapestry.apache.org/component-rendering.html
On Jul 31, 2014 10:45 AM, "Matt Resch" <ma...@gmail.com> wrote:

> Hey all,
>
>
>
> I’ve recently been using T 5.3 for an internal site, and have run into a
> bit of a snag when using a select component along with a zone and blocks to
> conditionally render parts of a form. I’ll include my code below, but first
> I’d like to explain what I’m attempting to do, as well as what is going
> wrong. Essentially, I populate a t:select component first from a list of
> pre-defined values, then using the onValueChangedFrom() method, I get the
> value of the currently selected item from t:select in order to
> conditionally render the next part of my form. Each item in the select menu
> corresponds to a block, which is then displayed within a zone that
> corresponds to the t:select component. This all works fine, and is not the
> issue that I’m running into. The issue I do have however, is when the value
> for select corresponds to a block with a TextArea inside it, html comments
> appear within that area. Here is a snippet of code, with (un)important bits
> and pieces redacted. The block labeled createBlock is the one with a
> TextArea component within it.
>
>
>
> Test.java
>
>
>
> > @Property
> >                 private UploadedFile upload;
> >
> >                 @Property
> >                 private String createCSV;
> >
> >                 @Property
> >                 private List<String> action;
> >
> >                 @Component
> >                 private Form uploadForm;
> >
> >                 @Inject
> >                 private Block editBlock, uploadBlock, createBlock,
> > emptyBlock;
> >
> >                 @InjectComponent
> >                 private Zone uploadZone;
> >
> >                 public Object onActivate(){
> >                                 if(!userSession.isAuthenticated())
> >                                                 return LoginPage.class;
> >                                 action = Arrays.asList("Choose an
> option",
> > "Upload", "Create", "Edit");
> >                                 return null;
> >                 }
> >
> > public Object onValueChangedFromAction(String s){
> >                                                 if(s.equals("Upload")){
> >                                                                 return
> > uploadBlock;
> >                                                 }else
> > if(s.equals("Create")){
> >                                                                 return
> > createBlock;
> >                                                 }else
> if(s.equals("Edit")){
> >                                                                 return
> > editBlock;
> >                                                 }else
> >                                                                 return
> > emptyBlock;
> >                 }
>
>
>
> Test.tml
>
>
>
> > <html
> >                 t:type="layout"
> >                 t:pageName="Test"
> >                 t:pageTitle="Test"
> >                 xmlns:t="
> > http://tapestry.apache.org/schema/tapestry_5_3.xsd">
> >
> >                 <t:block t:id="emptyBlock">
> >                                 <br/>
> >                 </t:block>
> >
> >                 <t:block t:id="createBlock">
> >                                                 <table>
> >                                                                 <tr>
> >
> > <td class="name"><b>Write your own .csv here:</b> </td>
> >                                                                 </tr>
> >                                                                 <tr>
> >
> > <td><t:TextArea t:id="createCSV" t:value="createCSV" rows="5"
> > ></t:TextArea></td>
> >                                                                 </tr>
> >                                                 </table>
> >                 </t:block>
> >
> >                 <t:block t:id="uploadBlock">
> >                                 <t:label for="upload">Upload
> > file:</t:label>
> >                                 <input t:type="upload" accept="text/csv"
> > t:id="upload" t:value="upload" validate="required"/>
> >                 </t:block>
> >
> >
> >
> >                 <t:form t:id="uploadForm">
> >                                 <t:errors/>
> >                                                 <t:label
> > for="action">Create, edit, or upload .csv?</t:label>
> >                                                 <t:select t:id="action"
> > model="action" t:zone="uploadZone" t:value="actionSelection"
> > t:blankOption="NEVER" validate="required"/>
> >                                                                 <t:zone
> > t:id="uploadZone" id="uploadZone">
> >
> > <t:if test="action">
> >
> > </t:if>
> >                                                                 </t:zone>
> >                                                 <br/>
> >                                 <input type="submit" class="submitbutton"
> > value="${message:Test.button.submit}" style="vertical-align:middle;"/>
> >                                 &nbsp;
> >                                 <t:actionlink t:id="cancel"
> > class="cancelbutton">${message:Test.button.cancel}</t:actionlink>
> >                 </t:form>
> > </html>
>
>
>
> Below is an example of the comments that populate the TextArea upon
> switching from another block, line 17 refers to this line:
>
>
> <td><t:TextArea t:id="createCSV" t:value="createCSV"
> > rows="5"></t:TextArea></td>
>
>
>
>
> > <!--BEGIN bulkimport/Test:createcsv$renderdisabled
> > (context:bulkimport/Test.tml, line 17)--><!--BEGIN
> > bulkimport/Test:createcsv$discardbody (context:bulkimport/Test.tml, line
> > 17)--><!--END bulkimport/Test:createcsv$discardbody--><!--END
> > bulkimport/Test:createcsv$renderdisabled-->
> >
>
> Thanks in advance for all the help!
>
>
>
> Regards,
>
> Matthew A Resch
>