+ Start a Discussion
SaintMichaelSaintMichael 

repeat tag placement interfering with extension

I am using JQuery Mobile for an Apex/Visualforce page.

The problem is I am trying to section off 2 separate repeat tags, but when I adjust my repeat tags to certain divs,

 

I get the error message:

Description	Resource	Path	Location	Type
Save error: Unknown property 'InventoryExtension.product'	

 

Here is what I am trying:

 

<div data-role="page" data-theme="b" id="detailpage{!product.Id}">
		
		<!-- page header -->
		<div data-role="header"><!-- button for going back to mainpage -->
			<a href='#mainpage' id="backInventory" class='ui-btn-left'
			data-icon='home'> Home </a> <!-- page title -->
			<h1>Edit</h1>
		</div>
		
		<!-- page content -->
		<apex:repeat value="{!products}" var="product">
			<div id="#content" data-role="content">
				<h2 id="name"><label for="model{!product.Id}">
				<h2>Model</h2>
				</label> <input type="text" value="{!product.Model__c}"
				id="model{!product.Id}" /></h2>



			<div data-role="fieldcontain">
				<fieldset data-role="controlgroup">
					<apex:outputPanel rendered="{!product.checked_out__c}">
						<input checked="checked" data-mini="true" type="checkbox"
						name="checked_out" id="checked_out{!product.Id}"
						value="{!product.checked_out__c}" />
					</apex:outputPanel> 
					
					<apex:outputPanel rendered="{!!product.checked_out__c}">
						<input data-mini="true" type="checkbox" name="checked_out"
						id="checked_out{!product.Id}" value="{!product.checked_out__c}" />
					</apex:outputPanel> 
					<label for="checked_out{!product.Id}" data-inline="true">CheckedOut:</label>
				</fieldset>
			</div>



		<div data-role="fieldcontain"><label
			for="asset_tag{!product.Id}">Asset tag:</label> <input type="text"
			id="asset_tag{!product.Id}" value="{!product.Asset_Tag__c}" />
		</div>

		<div data-role="fieldcontain"><label
			for="operating_system{!product.Id}">Operating System:</label> <input
			type="text" id="operating_system{!product.Id}"
			value="{!product.Operating_System__c}" />
		</div>

		<div data-role="fieldcontain"><label
			for="serial_number{!product.Id}">Serial #:</label> <input type="text"
			id="serial_number{!product.Id}" value="{!product.Serial_Number__c}" />
		</div>

		<div data-role="fieldcontain"><label for="notes{!product.Id}">Notes:</label>
		<textarea id="notes{!product.Id}" value="{!product.Notes__c}">{!product.Notes__c}</textarea>
		</div>

		<div data-role="fieldcontain"><label for="hostname{!product.Id}">Host
		Name:</label> <input type="text" id="hostname{!product.Id}"
			value="{!product.Hostname__c}" />
		</div>

		<div data-role="fieldcontain"><label
			for="memory_size{!product.Id}">Memory Size:</label> <input
			type="text" id="memory_size{!product.Id}"
			value="{!product.Memory_Size__c}" />
		</div>



		<a href="#" data-role="button" data-id="{!product.Id}"
			class="updateButton" data-theme="b"> Update </a>
	
	</div>
</apex:repeat>
	</div>

 

I don't get any errors if I wrap the repeat tags around the entire div like so:

<apex:repeat value="{!products}" var="product">
	<div data-role="page" data-theme="b" id="detailpage{!product.Id}">
		
		<!-- page header -->
		<div data-role="header"><!-- button for going back to mainpage -->
			<a href='#mainpage' id="backInventory" class='ui-btn-left'
			data-icon='home'> Home </a> <!-- page title -->
			<h1>Edit</h1>
		</div>
		
		<!-- page content -->
		
			<div id="#content" data-role="content">
				<h2 id="name"><label for="model{!product.Id}">
				<h2>Model</h2>
				</label> <input type="text" value="{!product.Model__c}"
				id="model{!product.Id}" /></h2>



			<div data-role="fieldcontain">
				<fieldset data-role="controlgroup">
					<apex:outputPanel rendered="{!product.checked_out__c}">
						<input checked="checked" data-mini="true" type="checkbox"
						name="checked_out" id="checked_out{!product.Id}"
						value="{!product.checked_out__c}" />
					</apex:outputPanel> 
					
					<apex:outputPanel rendered="{!!product.checked_out__c}">
						<input data-mini="true" type="checkbox" name="checked_out"
						id="checked_out{!product.Id}" value="{!product.checked_out__c}" />
					</apex:outputPanel> 
					<label for="checked_out{!product.Id}" data-inline="true">CheckedOut:</label>
				</fieldset>
			</div>



		<div data-role="fieldcontain"><label
			for="asset_tag{!product.Id}">Asset tag:</label> <input type="text"
			id="asset_tag{!product.Id}" value="{!product.Asset_Tag__c}" />
		</div>

		<div data-role="fieldcontain"><label
			for="operating_system{!product.Id}">Operating System:</label> <input
			type="text" id="operating_system{!product.Id}"
			value="{!product.Operating_System__c}" />
		</div>

		<div data-role="fieldcontain"><label
			for="serial_number{!product.Id}">Serial #:</label> <input type="text"
			id="serial_number{!product.Id}" value="{!product.Serial_Number__c}" />
		</div>

		<div data-role="fieldcontain"><label for="notes{!product.Id}">Notes:</label>
		<textarea id="notes{!product.Id}" value="{!product.Notes__c}">{!product.Notes__c}</textarea>
		</div>

		<div data-role="fieldcontain"><label for="hostname{!product.Id}">Host
		Name:</label> <input type="text" id="hostname{!product.Id}"
			value="{!product.Hostname__c}" />
		</div>

		<div data-role="fieldcontain"><label
			for="memory_size{!product.Id}">Memory Size:</label> <input
			type="text" id="memory_size{!product.Id}"
			value="{!product.Memory_Size__c}" />
		</div>



		<a href="#" data-role="button" data-id="{!product.Id}"
			class="updateButton" data-theme="b"> Update </a>
	
	</div>

	</div>

</apex:repeat>

 

Any ideas? I really would like to have to separate sections within the same page-section.

Best Answer chosen by Admin (Salesforce Developers) 
Pat PattersonPat Patterson

Does e.Staff_Account__r.Name work?

All Answers

Pat PattersonPat Patterson

Hi Michael,

 

The problem is that you have a reference to product (in the div on the first line) outside the scope of the <apex:repeat> in which it's defined. If you only want a single detail page, containing multiple products, you should change the first div to something like

 

<div data-role="page" data-theme="b" id="detailpage">

 You'll also need to remove the ID suffix from the link to the detail page.

 

Cheers,


Pat

SaintMichaelSaintMichael

That's doable, but it interferes with too much with my UI.

 

Right now I am trying to get my sub-records out of the query but I am having a problem.

Im using this query:

 

products = [SELECT Id,Name, Model__c,checked_out__c,Operating_System__c,Serial_Number__c,
                    Asset_Tag__c,Hostname__c,Notes__c,Memory_Size__c,(Select Name, Assign_Date__c,Expected_Return_Date__c,
                     Is_Permanently_Assigned__c,Notes__c,Return_Date__c, Staff_Account__r.Name from Staff_Equipments__r)  from Equipment__c];   

 When I use a tool like RealForceExplorer I can see the Account.Name is getting joined in the query.

I cannot seem to burrow down to get the actual person names from the linked Staff_Account__r relationship.

 

Staff_Account__c 's parent is the Account object, so I want to get that person's name.

 

Here is my visualforce:

 

<div data-role="fieldcontain" id="staff_equipments">
		<label for="staff_equipments">Checkouts</label>
		<ul data-role="listview" data-inset="true">
			<apex:repeat var="e" value="{!product.Staff_Equipments__r}">
				<li>
				
				<div class="ui-grid-b">
					<div class="ui-block-a"><apex:outputText value="{!e.Name}"></apex:outputText></div>
					<div class="ui-block-b"><apex:outputText value="{!e.Assign_Date__c}"></apex:outputText></div>
					<div class="ui-block-c"><apex:outputText value="{!e.Return_Date__c}"></apex:outputText></div>
				</div>

				</li>
			</apex:repeat>
		</ul>
		</div>

 

I am getting data, I just don't understand how to get into the relationship's Staff_Account__c object, then get the parent Account.Name.

e.Name is giving me the Name for the Staff_Equipment__c record, instead of the parent Account object.

Pat PattersonPat Patterson

Does e.Staff_Account__r.Name work?

This was selected as the best answer
SaintMichaelSaintMichael

Yes, that was it!

Thank you,I should have caught that.