You need to sign in to do that
Don't have an account?

can't get the apex:param to pass value to controller?
I am trying to use apex:actionFunction that has one parameter in my apex:page javascript but the parameter is always null and I cannot figure out WHY?
I created a simple test page to test what I am doing:
--------------------------------------------------------------------------
<apex:page standardController="Quote" extensions="QuoteLineItems_ControllerExtension">
<apex:pagemessages />
<apex:pageBlock mode="edit">
<apex:form id="testPage_Form">
<script language="JavaScript" type="text/javascript">
function test1() {
alert('>> init TEST_PAGE <<');
updateTest('this is my test data');
}
</script>
<apex:actionFunction name="updateTest" action="{!updateTestData}">
<apex:param name="test_param1" value="TEST_DUMMY" />
</apex:actionFunction>
<input type='button' value='TEST 1' onclick='test1();'/>
</apex:form>
</apex:pageBlock>
</apex:page>
Here is a method in my the controller:
--------------------------------------------------
public PageReference updateTestData() {
System.Debug('>>> updateTest <<<');
String test_param1 = ApexPages.CurrentPage().getParameters().get('test_param1');
System.Debug('>>> test_param1 = '+ test_param1 + ' <<<');
return null;
}
Debug Log returns:
>>> updateTest <<<
>>> test_param1 = null <<< ?? WHY NULL, expecting 'this is my test data'
WHAT am I doing wrong?
Try this approach:
http://boards.developerforce.com/t5/Visualforce-Development/Apex-Param-not-being-passed-to-controller-simple-example/m-p/156418?query.id=275465#M18750
The work arround Shamil linked works for me, but can it really be the case, that the assignTo on apex:param still doesn't work with commandButtons? anyone know if there has happend anything on this since 2009?
-Ronni
you need a rerender on the commandbutton for it to pass the parameter to the controller.
try this
<apex:actionFunction name="updateTest" action="{!updateTestData}" reRender="">
<apex:param name="test_param1" value="" />
</apex:actionFunction>
ReRender tag is must itseems. My work around was to use ReRender="" & use oncomplete="window.open('{!customURL},'_parent');"