• sunny198218
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 1
    Replies

I have a VF Page where i'm trying to access custom setting in javascript and based on that custom setting, i'm trying to redirect the page to another Page. I have 2 issues here

 

1. I need this javascript to execute on page load. Currently the onload function written on body does not works.

 

2. If i click on button then onclick event does works and i only get an alert of "Hi" and nothng else so i believe it is not accessing custom setting in javascript. 

 

<apex:page id="Page" >

<script type="text/javascript">

function CheckLocking()
{
alert("Hi");
var originalbaseURL = baseURL;
var blockChanges = "{!$Setup.MaintenanceWindow__c.Block__c}";
alert("ok");
alert(blockChanges);
// Following is the url of Custom Lookup page. You need to change that accordingly
baseURL = "/apex/MaintenancePage";

if(blockChanges== 'Yes')
{
openPopup(baseURL, "lookup", 350, 480, "width="+width+",height=480,toolbar=no,status=no,directories=no,menubar=yes,resizable=yes,scrollable=yes", true);
}
}
</script>
<apex:form id="myForm">
<body onload="CheckLocking()">
</body>
<apex:commandButton value="click me" onclick="CheckLocking()"/>
<apex:outputText value="{!$Setup.MaintenanceWindow__c.Block__c}"/>


</apex:form>
</apex:page>

Hi,

 

I have created a VF Page as follows:

 

<apex:page standardController="Project__c" extensions="FileUploadController">
<apex:pageMessages />
<apex:outputLabel value="File" for="file"/>
<apex:inputFile value="{!document.body}" filename="{!document.name}" id="file"/>
</apex:page>

 

The following is code for extension.

 

public with sharing class FileUploadController {
public FileUploadController(ApexPages.StandardController controller) {

}
public Document document {
get {
if (document == null)
document = new Document();
return document;
}
set;
}

public PageReference upload() {

document.AuthorId = UserInfo.getUserId();
document.FolderId = UserInfo.getUserId(); // put it in running user's folder
try {
insert document;
} catch (DMLException e) {
ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR,'Error uploading file'));
return null;
} finally {
document.body = null;
document = new Document();
}

ApexPages.addMessage(new ApexPages.message(ApexPages.severity.INFO,'File uploaded successfully'));
return null;
}

}

 

Now i need to embed the VF Page onto standard page. After adding it onto standard Page layout, when i click on browse button and select a file and click on OK, the button of the standard page is still displayed as edit, there is no option to save. Also when i click on edit button the VF Page is vanished.

 

 

 

Can anyone help. Help is needed ASAP or can this be done?

Hey i have one small problem...

 

          i have  a picklist. I want to get the selected values in a textbox delimited by a ' , ' 

   Please suggest some code... 

 

tried using all javascript.. not working... Stuck in middle...

 

Pls save...