• Austin Davis 8
  • NEWBIE
  • 5 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 2
    Replies
Nothing seems to be working for me for trying to pass just a single variable between a VisualForce Page and its Controlller.

Attempt 1:
public String selectedItem {get; set;}

<apex:form>
     <apex:inputhidden value="{!selectedItem}" value="" id="itemID"/>
</form>

<script type="text/javascript">
function clickedItem(s)
{
jQuery("[id*='itemID']").val(s);
alert('{!selectedItem}'};
}
</script>

<tr onclick="clickedItem">
//................................
</tr>

Attempt 2:
public String selectedItem {get; set;}

public PageReference clickedItem(){
        selectedItem = ApexPages.currentPage().getParameters().get('itemID');
        System.Debug('Selected Item = ' + selecteditem);
        return null;
    }

<apex:form>
<apex:actionFunction action="{!clickedItem}" name="setSelectedItem">
<apex:param name="itemID" value="" assignto="{!selectedItem}"/>
</apex:actionFunction>
<apex:form>

If I try a normal actionfunction with set off by an onclick event then the parameter does not pass. I have been informed that I need to have the rerender attribute assigned. However, when I put in the rerender attribute I get the following error:
Uncaught SyntaxError: Unexpected token :

Any help is very much appreciated. Thanks.
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.
I have a VisualForce page that I have embedded into the account object, and I am trying to get the account's record id into the controller. I need the account id to make a new record.

Here's what I have so far:
private Account acct;
    public ChatterBoxNote__c newNote = new ChatterBoxNote__c();
    public ChatterBoxNote__c getNewNote(){
    
    return newNote;
}
public String Record_ID { get; set; }
public Id posID { get; set; }

public genericController(ApexPages.StandardController controller) {
    acct= (Account)controller.getRecord();
    posID = acct.Id;
}

public PageReference createNewNote(){
        System.Debug('PosID: ' + posID);
        newNote.Record_ID__c = (String)posID;

        //insert newNote;
        return null;
}

 
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.
I have a VisualForce page that I have embedded into the account object, and I am trying to get the account's record id into the controller. I need the account id to make a new record.

Here's what I have so far:
private Account acct;
    public ChatterBoxNote__c newNote = new ChatterBoxNote__c();
    public ChatterBoxNote__c getNewNote(){
    
    return newNote;
}
public String Record_ID { get; set; }
public Id posID { get; set; }

public genericController(ApexPages.StandardController controller) {
    acct= (Account)controller.getRecord();
    posID = acct.Id;
}

public PageReference createNewNote(){
        System.Debug('PosID: ' + posID);
        newNote.Record_ID__c = (String)posID;

        //insert newNote;
        return null;
}