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
satakshisatakshi 

link to contact(User) in vf page

Hello, I am writing a code where i want to show contact name as a link. so after clicking on the name i will go into org and edit delete the record. I want this on this line.   <apex:column colspan="5" value="{!accWrap.acc.Name}" /> Can anyone help me to achiev this?




<apex:page controller="ContactSelectClassController" sidebar="false" showHeader="false" standardStylesheets="false">
<html>
<head>
<meta charset="utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Send Mail</title>
<apex:stylesheet value="https://fonts.googleapis.com/css?family=Roboto:400,300,500,700,900"/>
<apex:stylesheet value="{!$Resource.SurveyMaster}"/>
<apex:includeScript value="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"/ >
<!--<link href="https://fonts.googleapis.com/css?family=Roboto:400,300,500,700,900" rel="stylesheet" type="text/css">
<link href="assets/css/master.css" rel="stylesheet">-->

<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
  <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
  <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<script>
function ShowHide(){
document.GetElementById('field1').display='block';
}
 
</script>
<style>
.lookupIcon {
 background-image: url('{!$Resource.LookupIcon}') !important;
 height:30px !important;
 width:30px !important;
 position:absolute !important;
 top:6px !important;
 right:-25px !important;
}

.lookupIconOn {
 background-image: url('{!$Resource.LookupIcon}') !important;
 height:30px !important;
 width:30px !important;
 position:absolute !important;
 top:6px !important;
 right:-25px !important;
}

.SearchField{
background: #F6F6F6;
    height: 36px;
    border-radius: 6px;
    border: 1px solid #E1E1E1;
    padding: 0 15px;
    width: 20%;
    font-family: 'Roboto', sans-serif;
    font-size: 16px;
    font-weight: 400;
    }
</style>

    <script type="text/javascript">
        function selectAllCheckboxes(obj,receivedInputID){
            var inputCheckBox = document.getElementsByTagName("input");
            for(var i=0; i<inputCheckBox.length; i++){
                if(inputCheckBox[i].id.indexOf(receivedInputID)!=-1){
                    inputCheckBox[i].checked = obj.checked;
                }
            }
        }
    </script>
    
     <script type="text/javascript">
      function doSearch() {
      searchServer(
      document.getElementById("name").value
     
      );
  }
  </script>
  <script type="text/javascript">
        function validate() {
     
            {
              alert ( "Survey has been sent successfully" );
              
            }
        
            }
    </script>
    </head>
    
    <body>
    
<header class="mainHeader">
    <div class="container clear">
        <a href="/apex/SBIndex" class="logo"><img src="{!$Resource.MainLogo}" alt=""/></a>
        <div class="nav">
            <ul>
                <li><a href="/apex/SBIndex" class="home"><img src="{!$Resource.HomeIcon}" alt=""/></a></li>
                <li><a href="/apex/SBQuestionBank">Question Bank</a></li>
                <li><a href="/apex/SBCreateSurvey">Create Survey</a></li>
                <li class="active"><a href="/apex/SBSendSurvey">Send Survey</a></li>
                <li><a href="/00O50000004d9Np">Report</a></li>
            </ul>
        </div>
    </div>
</header>


<section class="page-name">
    <div class="container clear">
        <h2>All Contacts</h2>
    </div>
</section>

<section class="bodyContainer">
    <div class="container clear">
    
    <apex:form >
     <!--<apex:commandButton value="Add Contact" action="{!RedirectCon}" style="font-weight: bold;display: inline-block !important;padding: 3px 15px !important;line-height: 35px !important;color: #fff !important;font-size: 15px !important;background: #75C181 !important;border-radius: 35px !important; min-width: 125px !important;text-align: center !important; margin-left: 12px !important;   margin-bottom: 20px; float: right;"/>-->
 
     <!--<apex:commandButton value="Edit Template" action="{!Redirect}" style="font-weight: bold;display: inline-block !important;padding: 3px 15px !important;line-height: 35px !important;color: #fff !important;font-size: 15px !important;background: #75C181 !important;border-radius: 35px !important; min-width: 125px !important;text-align: center !important; margin-bottom: 20px; float: right;"/>-->
    
        
   <!-- For search -->
   
      <apex:outputLabel for="searchText">Search Contact</apex:outputLabel>&nbsp;&nbsp;
         <apex:panelGroup >
            <apex:inputText id="searchText" styleClass="SearchField" value="{!searchText}"/>&nbsp;&nbsp;
              <apex:commandButton value="Search" action="{!search}" styleClass="green-btn" style="font-weight: bold;"/>
         </apex:panelGroup>
         
   <!-- For search -->
    
       <apex:pageBlock >
        <apex:messages style="color:red;font-size:15px;" /><br />
        <div style="overflow: scroll; width:100%; height:300px;">
          <apex:pageBlockTable value="{!searchResults}" var="accWrap" id="table" width="100%" cellpadding="0" cellspacing="0" border="0" styleclass="defaultTable addquestionpage" style="overflow:scroll;">
                                     
                    <apex:column colspan="2">
                        <apex:facet name="header">
                            <apex:inputCheckbox onclick="selectAllCheckboxes(this,'inputId')"/>
                        </apex:facet>
                      <apex:inputCheckbox value="{!accWrap.selected}" id="inputId"/>
                    </apex:column>
                     
                   
                      <apex:column colspan="5" value="{!accWrap.acc.Name}" />
                    <apex:column colspan="5" value="{!accWrap.acc.Email}" />
                    <apex:column colspan="5" value="{!accWrap.acc.Phone}" />
          </apex:pageBlockTable>
          </div>
             
          <!--<apex:pageBlockTable value="{!selectedAccounts}" var="c" id="table2" width="100%" cellpadding="0" cellspacing="0" border="0" styleclass="defaultTable addquestionpage" style="margin-top:20px;">
                   <apex:column colspan="4" value="{!c.Id}" headerValue="Contact"/>
                    <apex:column colspan="4" value="{!c.Name}" headerValue="Contact Name"/>
                    <apex:column colspan="4" value="{!c.Email}" headerValue="Email"/>
                    <apex:column colspan="4" value="{!c.Phone}" headerValue="Phone"/>
           </apex:pageBlockTable>-->
        
          </apex:pageBlock>
      
         <div class="feild buttons">
                
                <apex:commandButton value="Send Survey" onclick="validate()"  action="{!processSelected}" styleClass="green-btn" rerender="table2" style="margin-top: 20px;font-weight: bold;"/>
                <apex:commandButton value="Cancel" action="{!CancelAction}" styleClass="red-btn" style="font-weight: bold;"/>
           
         </div>
         
         </apex:form>
     </div>
</section>

<footer class="main-footer">
    <ul>
        <li> <a href="#">Privacy Policy</a> </li>
        <li><a href="#">Terms of Services</a></li>
    </ul>
    <div class="copyright">© 2016 Survey Builder, All rights reserved. </div>
</footer>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
</body>
</html>

</apex:page>
Best Answer chosen by satakshi
Jason FlippenJason Flippen
Hi satakshi,

You need to make sure your wrapper class is also returning the Id of the Account.  Once that is in place you can replace this line of code:
<apex:column colspan="5" value="{!accWrap.acc.Name}" />
With this line of code:
<apex:column colspan="5">
	<apex:facet name="header">
		<apex:outputText value="{!$ObjectType.Account.Fields.Name.Label}" />
	</apex:facet>
	<apex:outputLink value="/{!accWrap.acc.Id}">{!accWrap.acc.Name}</apex:outputLink>
</apex:column>
I hope this helps.

Jason

All Answers

Jason FlippenJason Flippen
Hi satakshi,

You need to make sure your wrapper class is also returning the Id of the Account.  Once that is in place you can replace this line of code:
<apex:column colspan="5" value="{!accWrap.acc.Name}" />
With this line of code:
<apex:column colspan="5">
	<apex:facet name="header">
		<apex:outputText value="{!$ObjectType.Account.Fields.Name.Label}" />
	</apex:facet>
	<apex:outputLink value="/{!accWrap.acc.Id}">{!accWrap.acc.Name}</apex:outputLink>
</apex:column>
I hope this helps.

Jason
This was selected as the best answer
satakshisatakshi
Thanks a lot jason its working