3
<apex:repeat value="{!Requests}" var="request">
    <tr>
        <td>{!request.Subject}</td>
        <td>{!request.Type}</td>
        <td>{!request.Location__r.Name}</td>
        <td>
            <apex:outputText value="{0,date,MM/dd/yyyy}" >
                <apex:param value="{!request.CreatedDate}"/>
            </apex:outputText>
        </td>
    </tr>
</apex:repeat>

On click of request.subject I need to pass variable (Subject) to controller.how to achieve I this.I don't want to use commandlink and param to pass parameters.

| improve this question | | | | |
4

Try to use apex:actionFunction

Controller

public String mySubject {get;set;}

public PageReference myMethod(){
    System.debug('mySubject: ' + mySubject);
}

Page

<apex:actionFunction name="send"
                     action="{!myMethod}"
                     reRender="none">
    <apex:param name="p1" assignto="{!mySubject}" value=""/>
</apex:actionFunction>

<apex:repeat value="{!Requests}" var="request">
    <tr>
        <td><a href="#" onclick="send('{!request.Subject}')">{!request.Subject}</a></td>
        <td>{!request.Type}</td>
        <td>{!request.Location__r.Name}</td>
        <td>
            <apex:outputText value="{0,date,MM/dd/yyyy}" >
                <apex:param value="{!request.CreatedDate}"/>
            </apex:outputText>
        </td>
    </tr>
</apex:repeat>
| improve this answer | | | | |
2

You can also try using the actionSupport tag. See here for the docs.

    <apex:repeat value="{!Requests}" var="request">
        <tr>
            <td><apex:outputText value="{!request.Subject}">
             <apex:actionSupport event="onclick" >
               <apex:param name="p1" assignto="{!mySubject}" value="{!request.Subject}"/>
             </apex:actionSupport>
            </apex:outputText></td>
            <td>{!request.Type}</td>
            <td>{!request.Location__r.Name}</td>
            <td>
                <apex:outputText value="{0,date,MM/dd/yyyy}" >
                    <apex:param value="{!request.CreatedDate}"/>
                </apex:outputText>
            </td>
        </tr>
    </apex:repeat>

note: This has been hacked in the browser so there maybe some typos...

| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.