+ Start a Discussion
TechSteveTechSteve 

Set value of inputfield on the page

Hi all, I have used a controller extension to get the last record created for an object. I can display the $object.name in an outputLabel but need to save it with the record on the current page. Can you assign a value to an inputfield automatically (but not as formula), I can't get it to?

I don't want to rely on the user copy and pasteing? is there a way of saving the label value into the record?

I need to do this in the page or controller and use variables to carry the values around as there are 9 possibilities as to what the name may be.

** Page Code fragment**

<apex:pageBlockTable value="{!IARs}" var="ss" rendered="False">   
                    <apex:column breakBefore="true" headerValue="input Specific Form"><apex:inputfield value="{!ProgressNote__c.Relobject__c}"></apex:inputfield></apex:column>
                </apex:pageBlockTable>
                <apex:pageBlockTable value="{!IARs}" var="ss" rendered="{!IAR}">   
                    <apex:column breakBefore="true" headerValue="Assessment Type"><apex:outputLabel >{!ProgressNote__c.Relobject__c}</apex:outputLabel></apex:column>
                </apex:pageBlockTable>
 
                <apex:pageBlockTable value="{!IARs}" var="ss" rendered="{!IAR}">   
                    <apex:column breakBefore="true" headerValue="Record Number"><apex:outputLabel value="{!ss.name}"/></apex:column>
                </apex:pageBlockTable>
                <apex:pageBlockTable value="{!IARs}" var="ss" rendered="true">   
                    <apex:column breakBefore="true" headerValue="Input Specific Record"><apex:inputfield value="{!ProgressNote__c.RelformRec__c}">{!ss.name}</apex:inputfield></apex:column>
                </apex:pageBlockTable>

 

** Controller **

public ApexPages.StandardSetController setiar {
        get {
                if(setiar == null){
                setiar = new ApexPages.StandardSetController(Database.getQueryLocator(
                    [SELECT name From INS_Annual_Review__c
                        Where ClientID__c = :ApexPages.currentPage().getParameters().get('cid') Order By name DESC limit 1]));
                }
                    return setiar;
            }
            set;
    }
   
    public List<INS_Annual_Review__c> getIARs() {
         return (List<INS_Annual_Review__c>) setiar.getRecords();
         }

Thank you

 

Steve