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;"/>
<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
[Compassion, Excellence, Reliability]
________________________________
CONFIDENTIALITY NOTICE: This email may contain information belonging to BAYADA
and is protected by law. Do not forward, copy, or otherwise disclose to anyone
unless permitted by BAYADA or required by law. If you are not the intended
recipient, please notify the sender immediately.