You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Geoff Callender (JIRA)" <ji...@apache.org> on 2013/12/12 14:37:07 UTC

[jira] [Created] (TAP5-2261) Label not working with field containing other fields

Geoff Callender created TAP5-2261:
-------------------------------------

             Summary: Label not working with field containing other fields
                 Key: TAP5-2261
                 URL: https://issues.apache.org/jira/browse/TAP5-2261
             Project: Tapestry 5
          Issue Type: Bug
          Components: tapestry-core
    Affects Versions: 5.4
            Reporter: Geoff Callender


I'm trying to update an example from T5.3 to T5.4:

http://jumpstart.doublenegative.com.au/jumpstart/examples/component/subformasafield1

However, I cannot get the label to show for the "invitedPersons" field which is a component containing fields. Here is the modernised template:

		<t:form t:id="form" validate="invitation" class="form-horizontal well">
			<h4>Create Invitation</h4>

			<div class="form-group">
		 		<t:label class="col-sm-3" for="eventDescription"/>
		 		<div class="col-sm-3">
		 			<t:textfield t:id="eventDescription" value="invitation.eventDescription"/>
		 		</div>
			</div>
			<div class="form-group">
	 			<t:label class="col-sm-3" for="invitedPersons"/>
		 		<div class="col-sm-3">
					<t:examples.component.SelectPersonsField t:id="invitedPersons" class="form-control" persons="allPersons"
						chosen="invitation.invitedPersons" min="1" />
				</div>
		 	</div>
			<div class="form-group">
				<div class="col-sm-3 col-sm-offset-3">
					<t:submit value="Save"/>
				</div>
			</div>

			<t:errors globalOnly="true"/>
		</t:form>

The rendered HTML of the label leaves out the 'for="invitedPersons", and there is no element with id="invitedPersons". Here's what comes out where invitedPersons should be…

<div class="form-group">
	 			<label class="control-label col-sm-3"></label>
		 		<div class="col-sm-3">
					
	<!-- This is the component's output -->
 	<div class="form-group well">
		
			<div class="col-sm-2">
				<input id="person" name="person" type="checkbox">
			</div>
			<div class="col-sm-10">
				a&nbsp;b
			</div>
		
			<div class="col-sm-2">
				<input id="person_0" name="person_0" type="checkbox">
			</div>
			<div class="col-sm-10">
				asdf&nbsp;d
			</div>
	
	</div>
				</div>
		 	</div>

…whereas eventDescription comes out fine…

<div class="form-group">
		 		<label for="eventDescription" class="control-label col-sm-3">Event Description</label>
		 		<div class="col-sm-3">
		 			<input data-required-message="Event Description may not be null" data-optionality="required" data-validation="true" id="eventDescription" class="form-control" name="eventDescription" type="text">
		 		</div>
			</div>

SelectPersonsField component is definitely a Field…

    public class SelectPersonsField implements Field {

…and here is its template, just in case it's somehow the problem…

<t:content>

 	<div class="form-group well">
		<t:loop source="persons" value="person" formstate="iteration">
			<div class="col-sm-2">
				<t:checkbox t:id="person" value="personChosen" disabled="prop:disabled"/>
			</div>
			<div class="col-sm-10">
				${person.firstName}&nbsp;${person.lastName}
			</div>
		</t:loop>
	</div>
 	
</t:content>





--
This message was sent by Atlassian JIRA
(v6.1.4#6159)