0

I am working on a VisualForce page where a user updates a record by inputting value into inputtext field and presses the SAVE button.

For testing I tried to make it as simple as possible.

VF - updated

<apex:form >

<td> 
<apex:inputText id="TeacherWageFromPage" value="{!inputText1}"/> 
</td>

<td>
<apex:commandLink action="{!save}" value="save" >
<apex:param name="saveOrder" value="{!o.id}" assignTo="{!OrderToUpdateFromPage}"/>
</apex:commandLink>
</td>

</apex:form>

APEX

public String inputText1 {get;set;}

    public void save() {
    System.debug(inputText1);
    System.debug('o ' +ordertoupdate);
    }

When I check the log the inputText1 value is always NULL even though I have typed something into the inputtext box. The 2nd value the order I have passed in from the apex:param is working though.

3
  • Is there a possibility you have been using the inpuText field inside a Table or list of objects?
    – VarunC
    Commented Mar 1, 2015 at 12:37
  • apologise I didn't make it clear enough, but yes the inputtext field is inside a table, so is the commandlink. the VF displays a list of records in a table, each row will have a <td> inputTextfield </td> and also the <td> commandlink </td> does this affect the passing of the value?
    – yellowSF
    Commented Mar 1, 2015 at 14:40
  • updated the VF code to show the structure - hope that helps to explain the situation a bit more
    – yellowSF
    Commented Mar 1, 2015 at 14:44

1 Answer 1

0

I would suggest to go through with the First Answer to this question here:

Passing Inputtext field value in table to Apex controller

This should resolve your confusion regarding how to make certain that your variables are being set correctly.

2
  • Hi @VarunC, thanks for the update and link to your previous answer. I have a follow up question based on the sample code you list: <apex:commandLink action="{!saveSingleRecord}" rerender="thePageBlock" status="loadingStatus"> Update <apex:param value="{!rec.id}" name="myRecId" /> What is the purpose of rerender="thePageBlock"?? does this in any way help or impact the SETTING of the values inputted into the inputText fields?
    – yellowSF
    Commented Mar 3, 2015 at 15:24
  • It is an Ajax rendering of the component. That means only that container or control is refreshed or i should say communicate with salesforce and fetch u back data.
    – VarunC
    Commented Mar 3, 2015 at 15:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .