You need to sign in to do that
Don't have an account?
Courtney M Brown
Visualforce page with pop-up
Hi All,
I am using the Campaign object to track my organizations Conference data. I've searched through the archives but can't find an answer to my question.
Goal: Use the visualforce page I created to display just the name of the Conference (field name= "Name") and the number of attendees (field name= No_of_Attendees_c). I want that info to be housed in an alert box. I'm new to using javascript and Custom Controllers.
Here's the code I have so far:
<apex:page controller="Campaign">
<apex:form >
<apex:outputlabel value="Campaign Name"/>
<apex:inputtext value="{!Campaign.Name}">
<apex:actionsupport event="onclick" rerender="display" />
</apex:inputtext>
<apex:outputpanel id="display">
<apex:outputtext value="Number of Attendees {!Campaign.No_of_Attendees__c}"/>
</apex:outputpanel>
</apex:form>
</apex:page>
Controller:
public class Campaign
{
public String getCampaign() {
return null;
}
public String userinput{get; set;}
}
I know I'm doing something wrong...
Thanks in advance
I am using the Campaign object to track my organizations Conference data. I've searched through the archives but can't find an answer to my question.
Goal: Use the visualforce page I created to display just the name of the Conference (field name= "Name") and the number of attendees (field name= No_of_Attendees_c). I want that info to be housed in an alert box. I'm new to using javascript and Custom Controllers.
Here's the code I have so far:
<apex:page controller="Campaign">
<apex:form >
<apex:outputlabel value="Campaign Name"/>
<apex:inputtext value="{!Campaign.Name}">
<apex:actionsupport event="onclick" rerender="display" />
</apex:inputtext>
<apex:outputpanel id="display">
<apex:outputtext value="Number of Attendees {!Campaign.No_of_Attendees__c}"/>
</apex:outputpanel>
</apex:form>
</apex:page>
Controller:
public class Campaign
{
public String getCampaign() {
return null;
}
public String userinput{get; set;}
}
I know I'm doing something wrong...
Thanks in advance
please modify your code as above it will work.
thanks,
Ramesh
All Answers
thanks,
RAmesh
Thanks so much! The code appears to be working :) However, when I tried to update the pop-up text with the fields for Campaign Name and No of Attendees I receive an error message.
Error: Could not resolve the entity from <apex:outputField> value binding '{!Campaign.Name}'. <apex:outputField> can only be used with SObjects, or objects that are Visualforce field component resolvable.
Is this not the correct location for those fields?
<apex:outputPanel id="tstpopup">
<apex:outputPanel styleClass="popupBackground" layout="block" rendered="{!displayPopUp}"/>
<apex:outputPanel styleClass="custPopup" layout="block" rendered="{!displayPopUp}">
<apex:outputfield value="{!Campaign.Name}"/>
<apex:outputfield value="{!Campaign.No_of_Attendees__c}"/>
<apex:commandButton value="Hide Pop up" action="{!closePopup}" rerender="tstpopup"/>
</apex:outputPanel>
</apex:outputPanel>
Many thanks!
thanks,
RAmesh
<apex:page controller="Campaign">
<apex:form >
<apex:commandButton value="Show Pop up" action="{!showPopup}" rerender="Campaign"/>
<apex:pageBlock >
This is just filler text from the Salesforce General.
</apex:pageBlock>
<apex:outputPanel id="Campaign">
<apex:outputPanel styleClass="popupBackground" layout="block" rendered="{!displayPopUp}"/>
<apex:outputPanel styleClass="custPopup" layout="block" rendered="{!displayPopUp}">
<apex:outputfield value="{!Campaign.Name}"/>
<apex:outputfield value="{!Campaign.No_of_Attendees__c}"/>
<apex:commandButton value="Hide Pop up" action="{!closePopup}" rerender="Campaigns"/>
</apex:outputPanel>
</apex:outputPanel>
</apex:form>
<style type="text/css">
.custPopup{
background-color: white;
border-width: 2px;
border-style: solid;
z-index: 9999;
left: 50%;
padding:10px;
position: absolute;
/* These are the 3 css properties you will need to change so the popup
displays in the center of the screen. First set the width. Then set
margin-left to negative half of what the width is. You can add
the height property for a fixed size pop up if you want.*/
width: 250px;
margin-left: -250px;
top:100px;
}
.popupBackground{
background-color:black;
opacity: 0.20;
filter: alpha(opacity = 20);
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
z-index: 9998;
}
</style>
</apex:page>
Controller:
public class Campaign
{
public Campaign CO{get{
Campaign a=[Select ID,Name,No_of_Attendees__c from Campaign Limit 1];
return a;}
set;}
}
Error Message: Error: Could not resolve the entity from <apex:outputField> value binding '{!Campaign.Name}'. <apex:outputField> can only be used with SObjects, or objects that are Visualforce field component resolvable.
Is this because the Campaign Name is not an SObject?
Thank you!!
inputFiled and outputFiled are support to Sobjects only.
let me know if you have any clarifications.
NOte:Make it as best answer if it works.
thanks,
Ramesh
thanks,
Ramesh
Here is what I have along with the error message:
<apex:page controller="tstpopup">
<apex:form >
<apex:commandButton value="Show Pop up" action="{!showPopup}" rerender="tstpopup"/>
<apex:pageBlock >
This is just filler text from the Salesforce General.
</apex:pageBlock>
<apex:outputPanel styleClass="custPopup" layout="block" rendered="{!displayPopUp}">
<apex:outputfield value="{!CO.Name}"/>
<apex:outputfield value="{!CO.No_of_Attendees__c}"/>
<apex:commandButton value="Hide Pop up" action="{!closePopup}" rerender="Campaigns"/>
</apex:outputPanel>
</apex:form>
<style type="text/css">
.custPopup{
background-color: white;
border-width: 2px;
border-style: solid;
z-index: 9999;
left: 50%;
padding:10px;
position: absolute;
/* These are the 3 css properties you will need to change so the popup
displays in the center of the screen. First set the width. Then set
margin-left to negative half of what the width is. You can add
the height property for a fixed size pop up if you want.*/
width: 250px;
margin-left: -250px;
top:100px;
}
.popupBackground{
background-color:black;
opacity: 0.20;
filter: alpha(opacity = 20);
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
z-index: 9998;
}
</style>
</apex:page>
Controller:
public class Campaign
{
public Campaign CO{get{
Campaign a=[Select ID,Name,No_of_Attendees__c from Campaign Limit 1];
return a;}
set;}
}
Error: tstpopup Compile Error: Illegal assignment from LIST<Campaign> to Campaign at line 4 column 1
I so appreciate the help!
please modify your code as above it will work.
thanks,
Ramesh
Error: Could not resolve the entity from <apex:outputField> value binding '{!ac.Name}'. <apex:outputField> can only be used with SObjects, or objects that are Visualforce field component resolvable.
Any thoughts on what it might be?
I didn't understand why it is not working for you but same code is working fine for me.
sory for the inconvenience please try to copy the code once.
thanks,
Ramesh