+ Start a Discussion

Pass <Apex:input text> value to a link of <apex:command link>

Hi Everyone,
     I have a pretty straightforward requirement here. I have an <apex:input text > box on my page  and a <apex:commandbutton>. The command button point to a website e.g. google.com . I want when user enters the value in input text and clicks on the button , the button should open a new page with google.com/inputtextvalue. Can anyone please help me with this?

<apex:inputtext value="{!searchText}" id="DocumentText" rendered="true" />
<apex:commandLink > id="linkt" action="{!processLinkClick}">Search OnBase</apex:commandLink>

apex Code:
 public string searchText{get;set;}
 public PageReference processLinkClick() {
    return new PageReference('www.google.com/'+searchText);
Best Answer chosen by shrey.tyagi88@tcs.com
Raj VakatiRaj Vakati
Use this code 
public class ControllerClass{
    public string searchText{get;set;}
    public PageReference processLinkClick() {
        return new PageReference('https://www.google.com/'+searchText);

<apex:page controller="aaaa">
            <apex:inputtext value="{!searchText}" id="DocumentText" />
            <apex:commandLink  action="{!processLinkClick}" target="_blank" >Search OnBase</apex:commandLink>