You need to sign in to do that
Don't have an account?
ssfdc
Setting Apex:param after runtime from user input
I need to set a param once a user has changed the value of an inputText field so it will be sent once the user clicks the commandButton, I can't figure this one out and am reultant to scrap my design for JS remoting,
Use: Case
A list of differect products, a user can select a quantity then hit Add, the product Id and quanitity should be passed, the Id is set correctly as this is set at run time but how to set soemthing and bind it to command button once the page is loaded?
<apex:repeat value="{!prodList}" var="p">
{!p.Name}
<apex:inputText value="{!quant}"/>
<apex:commandButton action="{!addItem}" value="Add">
<apex:param name="id" assignTo="{!prodId}" value="{!p.Id}"/>
</apex:commandButton>
</apex:repeat>
Use: Case
A list of differect products, a user can select a quantity then hit Add, the product Id and quanitity should be passed, the Id is set correctly as this is set at run time but how to set soemthing and bind it to command button once the page is loaded?
<apex:repeat value="{!prodList}" var="p">
{!p.Name}
<apex:inputText value="{!quant}"/>
<apex:commandButton action="{!addItem}" value="Add">
<apex:param name="id" assignTo="{!prodId}" value="{!p.Id}"/>
</apex:commandButton>
</apex:repeat>
There's a detailed discussion on this at:
http://blog.jeffdouglas.com/2010/03/04/passing-parameters-with-a-commandbutton/
There's a couple of ways around this:
(1) Put an actionregion around each repeated element - this means that only the quant value inside the same action region as the command button will be sent to the controller
(2) Change your code to use wrapper classes, which contain the product sobject and the quantity - that way each repeated element will write its quant value back to its own wrapper class.