You need to sign in to do that
Don't have an account?
Displaying alertbox using VisualForce
Hi,
In the home page of opportunity, on click of the standard new button, I have to decide whether the current user could create a new record or not, based on his profile id.
If he could not create a new opportunity, then I have to display an alert box, saying "You don't have permission to create a new opportunity".
For this, I am overridding the new button with a visualforce page, which will check the profile id and perform accordingly.
So here, on click of the new button, the url is redirected to the visualforce page and in that blank visualforce page, the alert box is displayed. Then on clicking Ok in the alertbox, the url is again redirected to the home page of opportunity.
But I don't want this blank page to be displayed. On click of the new button, just the alert box has to be displayed, with out any change in the background.
For ex: if any alert box is displayed using the onclick javascript, there will not be any disturbance in the background.
Pls give ur suggestions on this?
"OnClick" event is for JavaScript and "action" is to perform a Controller method. "OnClick" event is run first and then "action" is performed. I think you are doing the validation part in the controller class. It is very difficult to tell something without seeing your JS code.
Could you please post your JS function here and then I can try to help you.
Actually here, independent of profile id,the user should be able to create a opportunity through lead conversion.
But for a particular profile, the user should not able create a new opportunity from the opportunity home tab.
So, if i remove the new permission, he could not create opportunity through lead conversion also.
Thats why, I am doing like this.
Yes, I couldn't figure out a way to render an actual javascript popup when returning from a method in the controller but this should work for you. In your controller method you just decide to displayPopUp, once the popup is displayed it greys out the background and once they hit OK, just navigate them to where they need to go.
<apex:outputPanel id="popup"> <apex:outputPanel styleClass="popupBackground" layout="block" rendered="{!displayPopUp}" /> <apex:outputPanel styleClass="customPopup" layout="block" rendered="{!displayPopUp}"> You don't have access to create Opportunity <br /> <br /> <apex:commandButton value="OK" action="{!navigate}" rerender="popup" /> </apex:outputPanel> </apex:outputPanel> <style type="text/css"> .customPopup { background-color: white; border-style: solid; border-width: 2px; left: 35%; padding: 10px; position: absolute; z-index: 9999; width: 500px; margin-left: 15%; top: 150px; } .popupBackground { background-color: black; opacity: 0.20; position: absolute; width: 100%; height: 100%; top: 0; left: 0; z-index: 9998; filter: alpha(opacity = 50); } </style>
Hi I have created a custom object. I need to display the records of this custom object in a javascript alert box of a visualforce page.
Should I create a new custom controller for this? Or can I achieve this with a controller extension of the custom object?
If possible plz provide a snippet of code to achieve this. Thanks