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

Problem in getting the values in Controller class

HI.. I am unable get and set the values for a visualforce page in Controller class. I have the below visualforce code.


<apex:pageBlockTable value="{!ords}" var="a" id="detailTable"> <apex:column headerValue="Item Name"> <apex:inputField id="itemId" value="{!a.Item__c}" onblur="setItemName();"/> <apex:inputHidden id="itemNameId" value="{!itemNameId}"/> </apex:column> <apex:column headerValue="Price"> <apex:inputField id="priceId" value="{!a.Price__c}" onblur="setItemPrice();"/> <apex:inputHidden id="itemPrice" value="{!itemPrice}"/> </apex:column> </apex:pageBlockTable>

 I am setting the values for itemNameId and itemPrice in javascript. Below is the code for that.

<script> function setItemName(){ //alert('Before setting the setItemName'); for(i=0; i<100; i++) { document.getElementById('soPage:theForm:blockId:detailTable:'+i+':itemNameId').value = document.getElementById('soPage:theForm:blockId:detailTable:'+i+':itemId').value; } } function setItemPrice(){ for(i=0; i<100; i++) { document.getElementById('soPage:theForm:blockId:detailTable:'+i+':itemPrice').value = document.getElementById('soPage:theForm:blockId:detailTable:'+i+':priceId').value; } } </script>


Also am setting the values for these fields in Controller class like below.


    public String itemNameId {get;set;}
    public String itemPrice {get;set;}


But my problem is that unable to get the values for those fields in Controller. 


Please let me know how I can achieve the same problem.


Thanks in advance.