function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
shrey.tyagi88@tcs.comshrey.tyagi88@tcs.com 

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:form>
        <apex:pageBlock>
            <apex:inputtext value="{!searchText}" id="DocumentText" />
            <apex:commandLink  action="{!processLinkClick}" target="_blank" >Search OnBase</apex:commandLink>
        </apex:pageBlock>
    </apex:form>
</apex:page>