1
<apex:page>
<head>
<apex:includeScript value="{!URLFOR($Resource.JqueryA, 'js/jquery-1.6.2.min.js')}"/>
<apex:includeScript value="{!URLFOR($Resource.JqueryA, 'js/jquery-ui-1.8.16.custom.min.js')}"/>
<apex:stylesheet value="{!URLFOR($Resource.JqueryA, 'css/ui-lightness/jquery-ui-1.8.16.custom.css')}"/>
</head>
<apex:form id="myForm">
<apex:pageblock id="pb" mode="maindetail">
<apex:variable value="{!1}" var="rowNum"/> 
<apex:repeat value="{!qouteLineItemMap}" var="qliRow" id="theQliRepeat">
<apex:repeat value="{!qouteLineItemMap[qliRow]}" var="qli" id="therepeat1">
<apex:variable value="{!1}" var="batchrowNum"/>
<table border="1" width="98%" style="border-collapse:collapse;" bordercolor = "Black" id="tble{!rowNum}"><tr><td> 
<table border="0" cellpadding="0" cellspacing="0" width="100%" id="tbleqli{!rowNum}"><tr><td style="padding-right:4px;padding-left:6px"> </td>
<td><b>No Of Batches</b></td>
</tr>        
<tr>           
<td style="padding-right:4px;padding-left:6px"><apex:outputText value="{!FLOOR(rowNum)}"/></td> 
<td>    
<apex:inputField value="{!qli.Number_of_B__c}"  >
<apex:actionSupport event="onchange" rerender="pb" oncomplete="this.disabled=true;" action="{!addBatch}">
<apex:param assignTo="{!qliRowNum}" value="{!rowNum}" name="qliRowNum" />
<apex:param assignto="{!Batchesnumber}" value="{!qli.Number_of_B__c}"  name="Batchesnumber"/>
</apex:actionsupport>            
</apex:inputField>
</td>
</tr>
</table>      
<br/> 
<apex:repeat value="{!batchMap[qliRow]}" var="child" id="therepeat2">
<table border="0" cellpadding="0" cellspacing="0" width="85%" id="inTble{!batchrowNum}">
<tr>
<td ></td>                 
<td><b>Asked Quantity</b></td>
</tr>
<tr>
<td style="padding-left:55px;"><apex:outputText value="{!FLOOR(batchrowNum)}" /></td> 
<td><apex:inputField value="{!child.batchObj.Asked_Qty__c}" style="width:110px"/></td>
</tr>
<apex:variable var="batchrowNum" value="{!batchrowNum+ 1}"/>  
</table>
</apex:repeat>
</td>
</tr> 
</table> 
<apex:variable var="rowNum" value="{!rowNum + 1}"/>                 
</apex:repeat>
</apex:repeat>
<apex:pageBlockButtons > 
<apex:commandbutton value="save" id="saveid" onclick="click1();" action="{!save1}"/>
<apex:commandbutton value="cancel" action="{!cancel1}" id="cancelId" immediate="True"/>
</apex:pageBlockButtons>  
</apex:pageBlock>
</apex:form>
</apex:page>

I am doing action support on inputfield :

<apex:inputField value="{!qli.Number_of_B__c}"  >
<apex:actionSupport event="onchange" rerender="pb" oncomplete="this.disabled=true;" action="{!addBatch}">
<apex:param assignTo="{!qliRowNum}" value="{!rowNum}" name="qliRowNum" />
<apex:param assignto="{!Batchesnumber}" value="{!qli.Number_of_B__c}"  name="Batchesnumber"/>
</apex:actionsupport>            
</apex:inputField>

When i gave value first time it is not doing any action . When i gave value for second time. it is executing the value of first time .when i gave value for third it is executing value of second time .Controller code was perfect no mistake on that . If i gave direct values on controller it was working fine . Any ideas from you would be great

4
  • What do you mean by "When i gave value" and what significance does the title "way to send iterable value as param on Map to controller salesforce" have to the problem?
    – Keith C
    Commented Aug 24, 2015 at 10:50
  • @KeithC Example: inputfield i typed firstly as value 2 action is not happened .then secondly i typed value as 5 action is executing with value as 2.thirdly if i typed value as 3 action is executing with value as 5 . if value="{!qli.Number_of_B__c}" for this hardcoded like value= "2" action is executed correctly . i want to pass this value from user input and action has to be happened Commented Aug 24, 2015 at 11:50
  • @Keith C Please let me know if you don't understand Commented Aug 24, 2015 at 12:07
  • I think I get it - see my answer.
    – Keith C
    Commented Aug 24, 2015 at 12:14

1 Answer 1

1

So the problem is that the {!qli.Number_of_B__c} value used with the apex:param is the value emitted from the server on the previous re-render rather than the live value from the apex:inputField.

The simplest fix is to not pass the value as an apex:param because that will always be a step behind. Instead at the server-side reference the qli.Number_of_B__c field directly as that will be updated as part of the apex:actionSupport post to the correct value.

You must log in to answer this question.

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