+ Start a Discussion
Austin Davis 8Austin Davis 8 

My variables won't pass to controller.

I have a variable I am trying to pass to the controller, but it is not working. According to several posts I've seen it should work. Here's my code:

VF:
<apex:actionFunction action="{!clickedRow}" name="call_clickedRow">
     <apex:param value="" assignTo="{!selectedRow}"/>
</apex:actionFunction>

<apex:repeat value="{!object1}" var="var1">
     <tr onclick="call_clickedRow({!var1.Name}); alert({!selectedRow});">
          //.................................................
          //.................................................
     </tr>
<apex:repeat>

Controller:
public String selectedRow{ get; set; }

public PageReference clickedRow(){
        return null;
}

I am however, getting a XmlHTTPSynchronous error that when expanded says that it is related to the onclick event shown above. I've tried several different methods of sending variables to the controller, but none have worked so far. I have also tried putting async=true in many places, but maybe not the right one. Any and all help would be appreciated. Thanks in advance.
Jim JamJim Jam
Try adding a rerender attribute to the actionFunction...see https://success.salesforce.com/issues_view?id=a1p300000008XHaAAM
sandeep reddy 37sandeep reddy 37
follow this link

https://success.salesforce.com/issues_view?id=a1p300000008XHaAAM
FearNoneFearNone
Hi Austin,
add rerender to actionfunction:
(reRender updates the result of display)
<apex:outputText value="{!selectedRow}" id="updateDisp" />

<apex:actionFunction action="{!clickedRow}" name="call_clickedRow" rerender="updateDisp">
     <apex:param value="" assignTo="{!selectedRow}"/>
</apex:actionFunction>
...

Best Regards!
 
Austin Davis 8Austin Davis 8
I added the rerender attribute which seemed to get rid of the synchronous issue. However, now I am getting the following error:
Uncaught SyntaxError: Unexpected token :

Troubleshoot process I took:
1. Action: Commented out onclick event
    Result: Error Remained
2. Action: emptied rerender quotations
    Result: Error Remained
3. Action: changed value on param from "" to "null"
    Result: Error Remained
4. Action: got rid of rerender attribute
    Result: No Error; Original Issue persists

I looked into the chrome console and there seemed to be an error in the javascript code that was generated from the apex code.
<script id="j_id0:j_id2:j_id4:j_id11:j_id16" type="text/javascript">setSelectedRow=function(j_id0:j_id2:j_id4:j_id11:j_id17)..........
                                                                                                           Error seems to occur Here ^