+ Start a Discussion
Jake GmerekJake Gmerek 

Passing Values from VF to controller

I have a fairly complicated VF page that is doing alot of things.  Everything is working except for line item editing.  Essentially I have a pageblock table that displays outputfields.  When a commandlink is pressed the output field for that row is not rendered and an input text field is rendered instead in its place. This is all working as desired.


However, when I hit the save command button, the value from the inputText field is not saved as part of the update statement.  It seems like I can not get the value to bind to the conroller.  I have tried using an input field, both with an separate object and as a way to update an entry in the mlines list  and neither work.  I have also tried various ideas using the <apex:param/> tag.


Any other ideas on why this will not work?


Here is the relevant code, there is much more but this should be the major sections involved.  Thanks in advance.



VF Page:

<apex:pageBlockTable value="{!mLines}" var="sl" title="Mechanical Lines">
        <apex:column styleClass="PN" headerValue="Part Number">
          <apex:outputfield value="{!sl.Part_Number__c}" rendered="{!removeId!=sl.id}" /> 
          <apex:inputText value="{!updatedPN}" rendered="{!removeId==sl.id}"/>
        <apex:column styleClass="action">
        <apex:commandLink value="Edit" action="{!EditLineStatus}" reRender="lineItems" immediate="true" rendered="{!removeId!=sl.id}">
            <apex:param value="{!sl.id}" assignTo="{!removeId}" name="removeId"/>
          <apex:commandLink value="Save" action="{!EditLine}" reRender="lineItems" immediate="true" rendered="{!removeId==sl.id}">
            <apex:param value="{!sl.id}" assignTo="{!removeId}" name="removeId"/>


public updatedPN {get; set;}

public pageReference editLine(){
        specifying_Lines__c updatedSl = new specifying_Lines__c(id = removeId, part_number__c = updatedPN);
        update updatedSl;
        removeId = '';
        return Null;


Rahul SharmaRahul Sharma

Jake Gmerek,


The issue might be with use of immediate="true" attribute in command link. Du to that it takes the previous value rather than updated one.

Put all your command links inside <apex:actionRegion> Tag.