function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Naveen Velkur 6Naveen Velkur 6 

a requirement to create a visual force page with the name purchase order have to capture transaction line items, name, product and qty in table. please correct the below code

 <apex:form>
        <apex:pageBlock title="Purchase Order" >
            <apex:pageBlockTable value="Transaction">
                <apex:column headerValue="Name" value="Name" />
              <apex:column headerValue="Product" value="Product__c" />
                <apex:column headerValue="Qty" value="Qty_Sold__c" />
            </apex:pageBlockTable>
        </apex:pageBlock>
    </apex:form>
SubratSubrat (Salesforce Developers) 
Hello naveen ,

To correct the provided Visualforce markup, you need to make a few adjustments to properly display the table and bind it to the appropriate controller or extension. Here's the corrected code:

You need to specify the correct value attribute for the apex:pageBlockTable, which should be a reference to the list of Transaction records you want to display.

For each apex:column, you should use the value attribute to specify the field API name that you want to display in that column.

Use the apex:inputField tag for editable fields, like Name and Qty, and use apex:outputField for non-editable fields, like Product.

Assuming you have a custom object named "Transaction_c" with fields "Name," "Productc," and "Qty_Sold_c," and you have a list of Transaction records in your controller or extension named "transactionsList," here's the corrected code:
<apex:page standardController="Transaction__c">
    <apex:form>
        <apex:pageBlock title="Purchase Order">
            <apex:pageBlockTable value="{!transactionsList}" var="transaction">
                <apex:column headerValue="Name">
                    <apex:inputField value="{!transaction.Name}" />
                </apex:column>
                <apex:column headerValue="Product">
                    <apex:outputField value="{!transaction.Product__c}" />
                </apex:column>
                <apex:column headerValue="Qty">
                    <apex:inputField value="{!transaction.Qty_Sold__c}" />
                </apex:column>
            </apex:pageBlockTable>
        </apex:pageBlock>
        <apex:commandButton value="Save" action="{!save}" />
    </apex:form>
</apex:page>
With this corrected code, you should be able to create a Visualforce page named "Purchase Order" that captures transaction line items with their Name, Product, and Quantity in a table. Make sure to adjust the controller or extension logic to handle the creation and manipulation of the "transactionsList" appropriately.

If this helps , please mark this as Best Answer.
Thank you.
Naveen Velkur 6Naveen Velkur 6
Thank you Subrat, 
Not sure, getting error  Unknown property 'Showroom_Request__cStandardController.transactionsList' , my full code is here as table sits in the code as below, please correct the below  code. 
Requirement is to create a report with the details and table with Table of transaction items.
<apex:page standardController="Showroom_Request__c" renderAs="pdf"  showHeader="false" sidebar="false">
    <html>
        <head>
            &nbsp&nbsp&nbsp&nbsp <p> Purchase Order- {!Showroom_Request__c.Name}</p>
        </head>
        <body>
            <div class="header">
                <div class="address">
                    <!-- Address on the top left page -->
                    <p>company name</p>
                    <p>address name</p>
                    <p>address city</p>
                     <p>country</p>   
                </div>
                <div class="account-details">
                    <!-- Business account name, address, and account details -->
                    <p>{!Showroom_Request__c.Account__c}</p>
                    <p>{!Showroom_Request__c.Showroom_Street_del__c}</p>
                    <p>{!Showroom_Request__c.Showroom_city_del__c}, {!Showroom_Request__c.Showroom_State_del__c} {!Showroom_Request__c.Showroom_Postal_code__c}</p>
                    <!-- Additional account details can be displayed here -->
                </div>
            </div>
       <apex:form>
        <apex:pageBlock title="Purchase Order">
            <apex:pageBlockTable value="{!transactionsList}" var="transaction">
                <apex:column headerValue="Name">
                    <apex:inputField value="{!transaction.Name}" />
                </apex:column>
                <apex:column headerValue="Product">
                    <apex:outputField value="{!transaction.Product__c}" />
                </apex:column>
                <apex:column headerValue="Qty">
                    <apex:inputField value="{!transaction.Qty_Sold__c}" />
                </apex:column>
            </apex:pageBlockTable>
        </apex:pageBlock>
        <apex:commandButton value="Save" action="{!save}" />
    </apex:form>

     </body>
    </html>