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
anu_karthianu_karthi 

problem with link redirecting to a detailpage

Hi i have created a visualforce page with following code

<apex:page showheader="false" action="{!initList}"
controller="PublicJobSearchController"
standardStylesheets="true">
<apex:composition template="{!$Site.Template}">
<apex:define name="body">
</apex:define>
</apex:composition>
<apex:form >
<!-- Search by Department, Location, or Keyword -->
<apex:pageBlock title="Search Job Postings">
<apex:pageBlockSection columns="1">
<apex:pageBlockSectionItem >
<apex:outputText value="Department"/>
<apex:selectList value="{!viewDepartmentName}"
id="departmentViews" size="1" required="true">
<apex:selectOptions value="{!DepartmentViewNames}"/>
</apex:selectList>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputText value="Location"/>
<apex:selectList value="{!viewLocationName}"
id="locationViews" size="1" required="true">
<apex:selectOptions value="{!LocationViewNames}"/>
</apex:selectList>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputText value="Keyword"/>
<apex:inputText value="{!searchPosition}"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputText value=""/>
<apex:commandButton value="Search"
action="{!PopulateQuery}" reRender="JobList" />
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
<!-- Search results -->
<apex:pageBlock title="Search Results">
<apex:pageBlockTable id="JobList" value="{!Position}"
var="Position__c" rendered="{!NOT(ISNULL(Position))}">
<apex:column >
<apex:facet name="header">
<apex:outputText value="Position ID"/>
</apex:facet>
<!-- Position name field linked to job details page -->
<apex:outputLink value="positiondetailpage?id={!Position__c.id}"
id="theLink">{!Position__c.name}</apex:outputLink>
</apex:column>


<apex:column >
<apex:facet name="header">
<apex:outputText value="Department"/>
</apex:facet>
<apex:outputText value="{!Position__c.Department__c}"/>
</apex:column>

<apex:column >
<apex:facet name="header">
<apex:outputText value="Job Description"/>
</apex:facet>
<apex:outputText value="{!Position__c.Job_Description__c}"/>
</apex:column>

</apex:pageBlockTable>
</apex:pageBlock>
</apex:page>

 

 

and the controller which i used is as follows

 

 

public class PublicJobSearchController {
Position__c[] ccts;
String searchPosition;
String positionid;
String DepartmentName = '%';
String LocationName = '%';
String likeStr = '%';
private String viewDepartmentName = 'Department';
private String viewLocationName = 'Location';
// Department picklist for the search page
private static final List<SelectOption>
VIEW_DEPARTMENT = new SelectOption[] {
new SelectOption('0','All Departments'),
new SelectOption('Engineering','Engineering'),
new SelectOption('Finance','Finance'),
new SelectOption('IT','IT'),
new SelectOption('Sales','Sales'),
new SelectOption('Support','Support')
};
// Location picklist for search page
private static final List<SelectOption>
VIEW_LOCATION = new SelectOption[] {
new SelectOption('0','All Location'),
new SelectOption('Bangalore','Bangalore'),
new SelectOption('Hyderabad','Hyderabad'),
new SelectOption('Delhi','Delhi'),
new SelectOption('Mumbai','Mumbai'),
new SelectOption('Chennai','Chennai')
};
public List<SelectOption> getDepartmentViewNames() {
return VIEW_DEPARTMENT;
}
public List<SelectOption> getLocationViewNames() {
return VIEW_LOCATION;
}
public void setViewDepartmentName(String viewDepartmentName) {
this.viewDepartmentName = viewDepartmentName;
}
public String getViewDepartmentName() {
return viewDepartmentName;
}
public void setViewLocationName(String viewLocationName) {
this.viewLocationName = viewLocationName;
}
public String getViewLocationName() {
return viewLocationName;
}
// Page onLoad action to auto-run the job postings query
public void initList() {
query();
}
public String getSearchPosition() {
return this.searchPosition;
}
public void setSearchPosition(String search) {
this.searchPosition = search;
}
public void populateQuery() {
likeStr = '%' + searchPosition + '%';
if (viewDepartmentName != '0') DepartmentName =
viewDepartmentName;
if (viewLocationName != '0') LocationName = viewLocationName;
query();
}
// Query to return the first 100 matching positions
public PageReference query() {
ccts = [SELECT id, Department__c, name,

Job_Description__c
FROM Position__c
WHERE Department__c like :DepartmentName


AND name like :likeStr
ORDER BY Name ASC
LIMIT 100];
return null;
}
public Position__c[] getPosition() {
return ccts;
}
}

 so in the visualforce code in this below line i have created a link to another visualforce page 

<apex:outputLink value="positiondetailpage?id={!Position__c.id}"
id="theLink">{!Position__c.name}</apex:outputLink>

 

 named position detailpage and now i enabled these 2 pages to sites now when i navigated to my site and clicked on the link its not redirected to the position detailpage instead its redirected to the  site is down for maintainence  ,please correct the code if any problem with the link  and if you have any further  questions

 

on my issue please let me know.So that i will clearly provide you with all required information

 

 

visualforce_devvisualforce_dev

I tried your code for a different custom object(in my instance) and its working fine for me. I am getting the detal page on clicking the link.

 

Please check whether u added the deatil page( VF page) to site's pages.

 

 

 

anu_karthianu_karthi

Hi i have checked it and detailpage is enabled in sites pages but still iam redirected to maintainence page but not

 

 redirected to  detailpage so please tell me how can i correct this problem. 

visualforce_devvisualforce_dev

HI,

 

pls chk this link this s my site using ur code with another custom onject loan

 

http://mybestsite-developer-edition.ap1.force.com/

 

Also .check profile settings. give read/view all access to guest / user using site.

 

this can be done by clicking on 'public access settings' on site detail page.