7
<a href="javascript:;" onclick="if(confirm('Are you sure?'))
    {remove2('{!oplist.lineNumber1}');}">

<img src="{!$Resource.Red_Cross}" alt="Remove" title="Remove" /></a>



<apex:actionFunction name="remove2" action="{!removeoppline2}" reRender="thePB">
    <apex:param name="name" value="rono" assignTo="{!proname}" />
</apex:actionFunction>

I also want to send record id like {!oplist.opplineNo.id} on remove image click..how can i send both line number and recordid simontaneously....pl help me with it

UPDATED

for(OpportunityLineItem l:lOpp) {    
    wrapperopllist.add(new linenumberclass(l,m));
    m++;
}

  <apex:repeat value="{!wrapperopllist}" var="oplist" rows="{!PageSize}" id="wrapid">

    <tr height="50px">
        <td class="Tdtext">{!oplist.lineNumber}
            <div id="{!rno}" style="display:none">
                <apex:image value="{!$Resource.Warning_Image}" height="15px" id="im" />
            </div>
        </td>
        <td class="Tdtext">{!oplist.oppLineNo.PricebookEntry.Product2.name}

        </td>



        <td class="Tdtext">
            <apex:inputField value="{!oplist.oppLineNo.Exclusive__c}" />
        </td>
        <td class="Tdtext">
            <apex:inputField value="{!oplist.oppLineNo.TV_Everywhere__c}" />
        </td>
        <td class="Tdtext">
            <apex:inputField value="{!oplist.oppLineNo.Description}" />
        </td>
        <td class="Tdtext">

            <a href="javascript:;" onclick="if(confirm('Are you sure?')){remove1('{!oplist.oppLineNo.id}','{!oplist.lineNumber}');}">
                                   <img src="{!$Resource.Red_Cross}" alt="Remove" title="Remove" />
                             </a>
            <apex:variable value="{!rno+1}" var="rno" />
        </td>

    </tr>

</apex:repeat>

<apex:actionFunction name="remove1" action="{!removeoppline}" reRender="thePB">
    <apex:param name="id" value="rno" assignTo="{!deleteid}" />

    <apex:param name="name" value="rno" assignTo="{!proname}" />
<apex:actionFunction/>


remove method

public void removeoppline() {
    system.debug('==='+wrapperopllist);
    System.debug('"""""""""""'+deleteid);
    wrapperopllist.remove(proname-1);

    for(Integer i = proname-1; i < wrapperopllist.size(); i++) {
        wrapperopllist[i].linenumber=proname;
        proname++;
    }

1 Answer 1

5

StackExchange Tip: You should update your question (and ensure future ones) to something more generic like 'How to pass more than one parameter to a actionFunction?'. And try to provide as much background as you can about the information being displayed/manipulated.

Answer: Assuming you can obtain the Id via the 'oplist' binding, and given what you've shared about this on a previous quesiton, this should work just fine...

remove2('{!oplist.lineNumber1}', '{!opList.oppLineNo.Id}');

Then add a second apex:param like so...

<apex:actionFunction name="remove2" action="{!removeoppline2}" reRender="thePB">
  <apex:param name="name" value="rono" assignTo="{!proname}"/>
  <apex:param name="id" value="rono" assignTo="{!proid}"/>
</apex:actionFunction>

NOTE: Make sure to expose 'proid' as a new controller variable, much like you have 'proname'.

The important thing with actionFunction parameters is to pass them in the correct order, although they are named, the name does not really get used. As you can see above, it's the order they are passed.

18
  • hey thanks...great..i wanted exactly like this..thanks again...
    – Mik
    Commented Nov 11, 2012 at 18:35
  • but i have doubt as oppLineNo is intance of opportunitylineitem...i should get {!opList.oppLineNo.Id} opportunity lineitemid intead i am getting opportunityid..i dont now why that is happening...
    – Mik
    Commented Nov 11, 2012 at 18:37
  • No problem, I've marked up your question for you as well, reads much better and will help future people benefit from your question and my answer. Commented Nov 11, 2012 at 18:37
  • can you figure where i can be wrong as i am getting opportunityid instead of oportunitylineitemid in proid..?
    – Mik
    Commented Nov 11, 2012 at 18:41
  • Can you update your answer with a little more VF markup, I think i know what your doing wrong, but need to see what VF markup your using to output the table. Commented Nov 11, 2012 at 18:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .