+ Start a Discussion
Chamil MadusankaChamil Madusanka 

OutputLink with action method

Hi All,

 

I want to create a output link  with some value and it needs to have an action method to control that link. That mean, according to the return value of action method, output link will be populate. How can  I do this?

 

Thanks in Advance!!

Darshan FarswanDarshan Farswan

I didn't get your question properly. How do you want that Link to be controlled. I mean which componet will render that Link.

 

This is something that I interpreted from the question. I might be wrong in this. If possible please reply.

 

Scenario : The button is used to render the Link i.e. to generete the content for the Link. I have used a random number to show that we can get any desired text.

 

APEX CLASS

public class atest{
    public Boolean flag {get;set;}
    public String random {get;set;}
    public void populateLink(){
        flag = true;
        random = String.valueOf(math.random());
    }
   
}

 

VF PAGE

<apex:page controller="atest">
    <apex:form >
        <apex:commandButton value="Populate" action="{!populateLink}" reRender="link"/>
    </apex:form>
    <apex:form id="link">
        <apex:commandLink rendered="{!flag}" value="{!random}"/>
    </apex:form>
</apex:page> 

Rehan DawtRehan Dawt

Hi Darshan,

 

Nice Example.

 

Thanks.

vijendra raivijendra rai
Looks like I know somebody.