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
Nikvm257Nikvm257 

Navigate to a link

Hello Gurus,

 

I have just started devlopment using vforce 

I am trying to devlop a simple app 

1) User will enter an ID(Account object)  on the page

 

2)when the user will click on go link  the page should be redirected to the account details.

 

In the below code I have hard coded th Id 

I want to do the same dynamically 

 

<apex:page ><apex:pageBlock >        <apex:pageBlockSection >        <apex:form id="MyForm">    <B>Please Enter an Account Number : </b>  <apex:inputText id="AccountNo" />   <apex:outputLink value="https://cs4.salesforce.com/apex/hello">   Go   <apex:param name="id"  value="001300000099rPu" />   </apex:outputLink>
        </apex:form>
    </apex:pageBlockSection>
</apex:pageBlock></apex:page>

 

Thanks lot in advance!

 

 

 

Best Answer chosen by Admin (Salesforce Developers) 
goabhigogoabhigo

I think its not possible and I must say I am not 100% sure. The reason is, when you specify param, the URL is appended with

?id= automatically. So in your case since you want to open the account detail page (standard page), supplying id parameter is in different way (for eg: https://ap1.salesforce.com/00190000007V42O). Param will help you if you need to open a VF page after clicking on Go link (in case you have overridden the standard detail page with your VF page).

 

I hope you are clear.

All Answers

goabhigogoabhigo

Ok here you go:

 

<apex:page >
 <apex:form id="MyForm">
 <script>
  function openLink() {
   var l =document.getElementById('{!$Component.pb:pbs:AccountNo}').value;
   window.open("/"+l, "_self");
  }
 </script>
 <apex:pageBlock id="pb">
  <apex:pageBlockSection id="pbs">
   <b>Please Enter an Account Number : </b>
    <apex:inputText id="AccountNo" />
    <br/> <br/>
    <a onclick="openLink()"> Go  </a>
   </apex:pageBlockSection>
  </apex:pageBlock>
 </apex:form>
</apex:page>

 

window.open(....., "_self") tells the browser to open thw new window in current page. If you don't want to open in the current page, just remove it.

 

Nikvm257Nikvm257

Thanks a lot foe replyiing back.

 

I have gone thru the code it seems that you have used script.

My question was is it not possible to read and assign  the value of the inputText  object and assign it to the param of a link object  ?

 

Would really appriciate your response.

 

Thanks 

 

 

 

 

goabhigogoabhigo

I think its not possible and I must say I am not 100% sure. The reason is, when you specify param, the URL is appended with

?id= automatically. So in your case since you want to open the account detail page (standard page), supplying id parameter is in different way (for eg: https://ap1.salesforce.com/00190000007V42O). Param will help you if you need to open a VF page after clicking on Go link (in case you have overridden the standard detail page with your VF page).

 

I hope you are clear.

This was selected as the best answer
Nikvm257Nikvm257

Thanks for reply !