• Demo29
  • NEWBIE
  • 5 Points
  • Member since 2009

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

Hi All

 

I am currently trying to create a sites page that redirects the user after a certain amount of inactivity, and I was wondering if anyone found a good way of doing this?

 

I tried using a class that would be activated when the user clicks on the form then waits until it sends back the pageReference, but the problem is it wouldn't reset when the user clicked the form again.

 

I then turned to javascript, creating a simple function that resets a timer, then waits before redirecting. The problem is the form contains outputPanels that render dynamically (all contained in the 1 form tag), and while the javascript works fine for the first visible panel, when the second is rendered, it stops reseting the first timer when the form is clicked on.

 

Small example of the code used:

 

 

<apex:page>
<script>
var timerId =0;
function tojs() {
clearTimeout(timerId);
timerId = setTimeout('redirect()',10000);
//set to 10 seconds for testing
}

function redirect() {
location.href = '../apex/FormTimeOut';
}
</script>
<apex:form id="frm" onclick="tojs()">
<apex:outputPanel rendered="{!render1}">
<apex:inputCheckbox value="{!render2}">
<apex:actionSupport event="onchange" action="{!render2ndPanel}" rerender="frm"/>
</apex:inputCheckbox>
</apex:outputPanel>
<apex:outputPanel rendered="{!render2}">
tra la la la
</apex:outputPanel>
</apex:form>




</apex:page>

 

So with this example the function tojs() would work as normal when the first outputPanel is clicked on (i.e. resetting the timer), but when the checkbox is ticked and the 2nd panel is rendered the tojs() timer is no longer reset. Could this be due to rerender?

 

Has anyone come up with a good way of doing this?

 

Thanks!

 

 

 

 

Message Edited by Demo29 on 09-30-2009 10:07 AM
Message Edited by Demo29 on 09-30-2009 10:07 AM
  • September 30, 2009
  • Like
  • 0

Hi

 

I am trying to create a VF page with the look and feel of another website, but am running into problems when I use an outputPanel as a <div> tag. I have uploaded the css as a Static Resource and referenced it in <apex:stylesheet> tags, and if I use <div> tags the formatting is fine, but when I try an replace it with <apex:outputPanel layout="block"> tags to utilise the rerender ability, the formatting disappears:

 

e.g.. this will render perfectly:

<div id="content" class="cType0">
<h3><strong>Text</strong></h3>
</div>

but this will not have all the formatting it should:

 

<apex:outputPanel layout="block" id="content" styleClass="cType0">
<h3><strong>Text</strong></h3>
</apex:outputPanel>

 

 For the most part this is not a problem, as I can just use the <div> tags for the layout and then only use the outputPanels when sf data is involved. The real problem comes when I add a commandButton to rerender sections. This works fine in Firefox, but errors in IE (6), with the Error 'Access is Denied to http://www.website.com/', where the website is where the css came from.

 

My knowledge of css isn't all that great, so I don't know whether there is something I need to change in the css file, or the vf code, but it seems strange that the problem is centered around a commandButton which only sends data to salesforce and rerenders some sections.

 

Does anyone have any idea why this might be happening?

 

Thanks

 

 

Message Edited by Demo29 on 08-19-2009 06:50 AM
  • August 19, 2009
  • Like
  • 0

Hi All

 

I am currently trying to create a sites page that redirects the user after a certain amount of inactivity, and I was wondering if anyone found a good way of doing this?

 

I tried using a class that would be activated when the user clicks on the form then waits until it sends back the pageReference, but the problem is it wouldn't reset when the user clicked the form again.

 

I then turned to javascript, creating a simple function that resets a timer, then waits before redirecting. The problem is the form contains outputPanels that render dynamically (all contained in the 1 form tag), and while the javascript works fine for the first visible panel, when the second is rendered, it stops reseting the first timer when the form is clicked on.

 

Small example of the code used:

 

 

<apex:page>
<script>
var timerId =0;
function tojs() {
clearTimeout(timerId);
timerId = setTimeout('redirect()',10000);
//set to 10 seconds for testing
}

function redirect() {
location.href = '../apex/FormTimeOut';
}
</script>
<apex:form id="frm" onclick="tojs()">
<apex:outputPanel rendered="{!render1}">
<apex:inputCheckbox value="{!render2}">
<apex:actionSupport event="onchange" action="{!render2ndPanel}" rerender="frm"/>
</apex:inputCheckbox>
</apex:outputPanel>
<apex:outputPanel rendered="{!render2}">
tra la la la
</apex:outputPanel>
</apex:form>




</apex:page>

 

So with this example the function tojs() would work as normal when the first outputPanel is clicked on (i.e. resetting the timer), but when the checkbox is ticked and the 2nd panel is rendered the tojs() timer is no longer reset. Could this be due to rerender?

 

Has anyone come up with a good way of doing this?

 

Thanks!

 

 

 

 

Message Edited by Demo29 on 09-30-2009 10:07 AM
Message Edited by Demo29 on 09-30-2009 10:07 AM
  • September 30, 2009
  • Like
  • 0

I have a Customer portal and force.com Site working together.

 

Under the customer portal profile I have added a visualforce page which needs run SOQL code and DML operations.

 

When go to the URL of my site:

 https://myorg.sandboxName.cs1.force.com/mysite/myVF-Page

 

It prompts me to login and authenticate, prefect so far...

 

However when I login, it forwards me to "Unauthorized" page with a message that says:

Error: Error occurred while loading a Visualforce page. 

 

I enabled the Debug log for that user and these are the things I see in the log file:

 


Cumulative profiling information:

No profiling information for SOQL operations.

No profiling information for SOSL operations.

No profiling information for DML operations.

No profiling information for method invocations.


Ihave no idea how to fix this problem, the custom profile that is clonedfrom "Customer Portal Manager Standard" profile has "API enabled" set.

What else should I do to make this work?

 

  • September 21, 2009
  • Like
  • 0

Hi

 

I am trying to create a VF page with the look and feel of another website, but am running into problems when I use an outputPanel as a <div> tag. I have uploaded the css as a Static Resource and referenced it in <apex:stylesheet> tags, and if I use <div> tags the formatting is fine, but when I try an replace it with <apex:outputPanel layout="block"> tags to utilise the rerender ability, the formatting disappears:

 

e.g.. this will render perfectly:

<div id="content" class="cType0">
<h3><strong>Text</strong></h3>
</div>

but this will not have all the formatting it should:

 

<apex:outputPanel layout="block" id="content" styleClass="cType0">
<h3><strong>Text</strong></h3>
</apex:outputPanel>

 

 For the most part this is not a problem, as I can just use the <div> tags for the layout and then only use the outputPanels when sf data is involved. The real problem comes when I add a commandButton to rerender sections. This works fine in Firefox, but errors in IE (6), with the Error 'Access is Denied to http://www.website.com/', where the website is where the css came from.

 

My knowledge of css isn't all that great, so I don't know whether there is something I need to change in the css file, or the vf code, but it seems strange that the problem is centered around a commandButton which only sends data to salesforce and rerenders some sections.

 

Does anyone have any idea why this might be happening?

 

Thanks

 

 

Message Edited by Demo29 on 08-19-2009 06:50 AM
  • August 19, 2009
  • Like
  • 0