• Carcajou
  • NEWBIE
  • 75 Points
  • Member since 2008

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

What does the following error mean? I am testing my first project and am getting the following error onm the "Account Name" field.

 

Error: j_id0:j_id2:j_id3:j_id11:j_id12: An error occurred when processing your submitted information.
Thank you

Hi

 How to blank out all the input field values on clicking the cancel command button.

 

below is my code. When the cancel button is clicked the data in the field should be removed. So that user can 

enter the new values and then click on save.

<apex:page controller="example2"> <apex:form > <apex:pageBlock mode="edit" > <apex:pageBlockSection > </apex:pageBlockSection> <apex:pageBlockSection > <apex:pageBlockTable value="{!Data}" var="dt"> <apex:column > Phone: <apex:inputField value="{!dt.phone}"/><br /> Email: <apex:inputField value="{!dt.email}"/> </apex:column> </apex:pageBlockTable> </apex:pageBlockSection> <apex:pageBlockButtons> <apex:commandButton action="{!save}" value="Save"/> <apex:commandButton action="{!cancel}" value="Cancel"/> </apex:pageBlockButtons> </apex:pageBlock> </apex:form> </apex:page> public class example2{ public User user; public User getData() { user=[Select phone,email from User where id=:UserInfo.getUserId()]; return user; } public PageReference save() { update user; return null; } public PageReference cancel() { return null; } }

 


 

Hi

Im a novice in VF and coding. Im writing a simple wizard for the Volunteer Management App. Add event info in step1, then click 'add participants" to go to participants to add participants.SFDC_Volunteer_Event__c (master) and SFDC_Volunteer_Participant__c(detail) are the objects. I have done this with a custom controller to replace the Events tab and it works!.

However, since I want to use the VF page to replace the "new" button, I need to use the standard controller and write an extension(right?).

 

2 VF pages VMXpage1, VMXPage2. 1 extension VMExtension.cls

Currently, I have only setup step 2, to add ONE participant, but I would like to extend it to add (like 'add row?". need inputs on how to do that too). but primarily, Im getting the error

 

Visualforce Page: /apex/VMXPage1

System.TypeException: Invalid conversion from runtime type SOBJECT:SFDC_Volunteer_Event__c to SOBJECT:SFDC_Volunteer_Participant__c

Class.VMExtension.<init>: line 9, column 21
External entry point

 

 

------------

Here is the code




public class VMExtension{

SFDC_Volunteer_Event__c vevent;

SFDC_Volunteer_Participant__c vpart1;

public VMExtension(ApexPages.StandardController stdController){
this.vevent=(SFDC_Volunteer_Event__c)stdController.getRecord();
this.vpart1=(SFDC_Volunteer_Participant__c)stdController.getRecord();
}


public PageReference event(){
return Page.VMXPage1;
}

public PageReference addparts(){
return Page.VMXPage2;
}

public PageReference saveevent(){
insert vevent;
vpart1.Volunteer_Event__c=vevent.id;
insert vpart1;
PageReference veventPage = new PageReference('/'+vevent.id);
veventPage.setRedirect(true);
return veventPage;
}
}
------
Here is the VF page

<apex:page standardController="SFDC_Volunteer_Event__c" extensions="VMExtension">

<apex:sectionHeader title="New Event Information" subtitle="step 1/2"/>

<apex:form id="theform">
<apex:pageBlock >
<apex:pageBlockButtons location="bottom">
<apex:commandButton value=" Save Event" action="{!saveevent}"/>
<apex:commandButton value="Add Participants" action="{!addparts}"/>
<apex:commandButton value="Cancel" action="{!cancel}"/>
</apex:pageBlockButtons>
<apex:pageBlockSection title="Event Information" columns="2">
<apex:inputField value="{!SFDC_Volunteer_Event__c.name}" required="true"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>

</apex:page>


---
<apex:page standardController="SFDC_Volunteer_Participant__c" extensions="VMExtension">
<apex:sectionHeader title="Add Participants to Event:" subtitle="step 2/2"/>
<apex:form id="AddParticipantForm">
<apex:pageBLock >
<apex:pageBlockSection >
<apex:panelGrid columns="2">
<apex:outputLabel value="Contact1"/>
<apex:inputField value="{!SFDC_Volunteer_Participant__c.Contact__c}"/>


</apex:panelGrid>
</apex:pageBlockSection>
<apex:pageBlockButtons location="bottom">
<apex:commandButton action="{!event}" value="Edit Event Info"/>
<apex:commandButton action="{!saveevent}" value="Save Event"/>
<apex:commandButton value="Cancel" action="{!cancel}"/>
</apex:pageBlockButtons>
</apex:pageBLock>
</apex:form>

</apex:page>
------

 

Im stuck. Please help. Thank you in advance

 

Message Edited by vviyer on 03-31-2009 05:40 PM
Message Edited by vviyer on 03-31-2009 05:41 PM
  • April 01, 2009
  • Like
  • 0

How the PageReference works with the  parameter?

 

Is the follwing possible?

 

<apex:include pageName="TestPageInclude?id=a00000198765yxz"/>

 

if not how do i achieve this? i read the document and it suggest to do following

 

ref1.getParameters().put(id,idVal);

 ref1.setRedirect(true);

retuen ref1;

 

If i write above code then include that as page include that doesn't work.

Any help is appreciated.

 

Thanks

 

Cheerz
Message Edited by Cheerz on 04-24-2009 06:03 PM
  • April 25, 2009
  • Like
  • 0

I have a problem which I think is simple but for some reason is eluding me. Here's the setup: I have two pageBlocks on the same VF page, but they are independent from each other, meaning user can fill either one or another and save one or another, not both. However both blocks have their own mandatory fields and each block has its own save button which fires up an extension method. 

 

The problem: button in one block always fires the validation for the entire page, regardless of where I put the actionRegion, thus preventing me from submiting jsut a portion I need (which is valid). I tried embedding the whole pageblocks in action regions, it didnt work, i tried just the sections, still no game. It seems like actionRegion has zero influence on the commandButton. Do keep in mind that I have to submit the page block data on button so immediate=true wont cut it. 

 

 

 

Message Edited by mmix on 04-02-2009 02:39 AM
  • April 02, 2009
  • Like
  • 0

What does the following error mean? I am testing my first project and am getting the following error onm the "Account Name" field.

 

Error: j_id0:j_id2:j_id3:j_id11:j_id12: An error occurred when processing your submitted information.
Thank you

Hi

 How to blank out all the input field values on clicking the cancel command button.

 

below is my code. When the cancel button is clicked the data in the field should be removed. So that user can 

enter the new values and then click on save.

<apex:page controller="example2"> <apex:form > <apex:pageBlock mode="edit" > <apex:pageBlockSection > </apex:pageBlockSection> <apex:pageBlockSection > <apex:pageBlockTable value="{!Data}" var="dt"> <apex:column > Phone: <apex:inputField value="{!dt.phone}"/><br /> Email: <apex:inputField value="{!dt.email}"/> </apex:column> </apex:pageBlockTable> </apex:pageBlockSection> <apex:pageBlockButtons> <apex:commandButton action="{!save}" value="Save"/> <apex:commandButton action="{!cancel}" value="Cancel"/> </apex:pageBlockButtons> </apex:pageBlock> </apex:form> </apex:page> public class example2{ public User user; public User getData() { user=[Select phone,email from User where id=:UserInfo.getUserId()]; return user; } public PageReference save() { update user; return null; } public PageReference cancel() { return null; } }

 


 

Hi

Im a novice in VF and coding. Im writing a simple wizard for the Volunteer Management App. Add event info in step1, then click 'add participants" to go to participants to add participants.SFDC_Volunteer_Event__c (master) and SFDC_Volunteer_Participant__c(detail) are the objects. I have done this with a custom controller to replace the Events tab and it works!.

However, since I want to use the VF page to replace the "new" button, I need to use the standard controller and write an extension(right?).

 

2 VF pages VMXpage1, VMXPage2. 1 extension VMExtension.cls

Currently, I have only setup step 2, to add ONE participant, but I would like to extend it to add (like 'add row?". need inputs on how to do that too). but primarily, Im getting the error

 

Visualforce Page: /apex/VMXPage1

System.TypeException: Invalid conversion from runtime type SOBJECT:SFDC_Volunteer_Event__c to SOBJECT:SFDC_Volunteer_Participant__c

Class.VMExtension.<init>: line 9, column 21
External entry point

 

 

------------

Here is the code




public class VMExtension{

SFDC_Volunteer_Event__c vevent;

SFDC_Volunteer_Participant__c vpart1;

public VMExtension(ApexPages.StandardController stdController){
this.vevent=(SFDC_Volunteer_Event__c)stdController.getRecord();
this.vpart1=(SFDC_Volunteer_Participant__c)stdController.getRecord();
}


public PageReference event(){
return Page.VMXPage1;
}

public PageReference addparts(){
return Page.VMXPage2;
}

public PageReference saveevent(){
insert vevent;
vpart1.Volunteer_Event__c=vevent.id;
insert vpart1;
PageReference veventPage = new PageReference('/'+vevent.id);
veventPage.setRedirect(true);
return veventPage;
}
}
------
Here is the VF page

<apex:page standardController="SFDC_Volunteer_Event__c" extensions="VMExtension">

<apex:sectionHeader title="New Event Information" subtitle="step 1/2"/>

<apex:form id="theform">
<apex:pageBlock >
<apex:pageBlockButtons location="bottom">
<apex:commandButton value=" Save Event" action="{!saveevent}"/>
<apex:commandButton value="Add Participants" action="{!addparts}"/>
<apex:commandButton value="Cancel" action="{!cancel}"/>
</apex:pageBlockButtons>
<apex:pageBlockSection title="Event Information" columns="2">
<apex:inputField value="{!SFDC_Volunteer_Event__c.name}" required="true"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>

</apex:page>


---
<apex:page standardController="SFDC_Volunteer_Participant__c" extensions="VMExtension">
<apex:sectionHeader title="Add Participants to Event:" subtitle="step 2/2"/>
<apex:form id="AddParticipantForm">
<apex:pageBLock >
<apex:pageBlockSection >
<apex:panelGrid columns="2">
<apex:outputLabel value="Contact1"/>
<apex:inputField value="{!SFDC_Volunteer_Participant__c.Contact__c}"/>


</apex:panelGrid>
</apex:pageBlockSection>
<apex:pageBlockButtons location="bottom">
<apex:commandButton action="{!event}" value="Edit Event Info"/>
<apex:commandButton action="{!saveevent}" value="Save Event"/>
<apex:commandButton value="Cancel" action="{!cancel}"/>
</apex:pageBlockButtons>
</apex:pageBLock>
</apex:form>

</apex:page>
------

 

Im stuck. Please help. Thank you in advance

 

Message Edited by vviyer on 03-31-2009 05:40 PM
Message Edited by vviyer on 03-31-2009 05:41 PM
  • April 01, 2009
  • Like
  • 0
I went through a bit of work to set up a lot of field dependencies and default values for a custom object which is a customer survey.  In the default layout everything is fine but the look and feel is horrid so I am attempting to create my first visualforce pages.  The field dependencies and default values don't seem to work in vf.  So I need to be able to set these things by hand I am guessing by using a controller extension?  Could someone give me a simple example of a yes or no picklist that causes the values to change in a second picklist and also a simple example of a picklist with a default value automatically selected.  Mine always have --None-- selected even though there are default values defined in the custom object...Thanks!

Hi,

   i am trying to make something, but i can't. I want to create a visualforce page where i will have a pageblock for each object, each object is in a list.
   for example, i have a List<Account>, and i want to show a page block for each Account

[pageBlock Account 1]
[pageBloc Account 2 ]
..
..
[pageBlock Account n ]

  where n is the size of my list, and pageblock i show the detail of the i element of the list.

thanks

Hello,

 

I have a requirement where on convert of a lead I want to add the original owner of the lead on the Opportunity Sales Team.

 

I am able to create a OpportunityTeamMember record but I am not able to set the access level. Compilation throws an error - "Field is not writeable"

 

Any ideas how can I set the access level?

 

 

//This works

OpportunityTeamMember tm = new OpportunityTeamMember(UserId = myId, OpportunityId = l.ConvertedOpportunityId, TeamMemberRole = role );

//this does not work
OpportunityTeamMember tm = new OpportunityTeamMember(UserId = myId, OpportunityId = l.ConvertedOpportunityId, TeamMemberRole = role, OpportunityAccessLevel = 'Read');

//throws error - field is not writeable

 

Thanks,

Rohit

 

In my visual force page,I am using <apex:actionstatus> and i assign two different JavaScript function to 'onstart' and 'onstop' attribute of actionstatus.onstart function is working fine but onstop function is not working well.
 
My sample code:
Code:
<apex:page Standardcontroller="Contact">
 <apex:form >
  <apex:pageBlock title="Calculated Lighting Measures" mode="edit" id="page">
   <apex:pageBlockButtons location="bottom">
    <apex:commandButton value="  Save  " action="{!Save}"  id="Sve"/>
    <apex:commandButton value="Cancel " action="{!Cancel}" />
    <script>
    function Btndisable()
    {
     alert("Hi");
    }
    function Btnenable()
    {
     alert("Hell0");
    }
    </script>
   </apex:pageBlockButtons>
   <apex:pageBlockSection columns="1" title="Information" id="info" >
    <apex:inputfield value="{!Contact.Picklist__c}">
     <apex:actionSupport event="onchange"  status="ActionStatus"  />
    </apex:inputfield>
    <apex:actionStatus id="ActionStatus" startText="Please Wait" onstart="BtnDisable()" onstop="BtnEnable()" ></apex:actionStatus>
   </apex:pageBlockSection>
  </apex:pageBlock>
 </apex:form >
</apex:page>               
              

 

 
Can any one help me to find , where i made mistake
 
Raj
  • December 16, 2008
  • Like
  • 0
 I'm am trying to create a simple selectAll check box at the top of my table but I can not figure out why this is not working. It's as if the data binding is not occurring when the check box is located in the header section of the table. If I remove the check box from the table it works fine.
 
This uses standard fields so it should be easy to copy and paste to reproduce.

Code:
Page:

<apex:page>
<c:resellerAccountSearch />
</apex:page>

Component:

<apex:component controller="resellerAccountSearch" >
<apex:form >
<apex:pageblock >

<apex:inputText value="{!searchValue}" id="searchtext"/>
<apex:commandButton value="Search" action="{!search}" rerender="results" status="search"/>
<br/>

<!-- This check box works fine but if it is in the header section below it doesn't work
<apex:inputCheckBox value="{!selectAllCheckbox}">
<apex:actionSupport event="onclick" action="{!selectAll}" rerender="results"/>
</apex:inputCheckBox> -->

<apex:actionStatus id="search">

<apex:facet name="start">
<strong>Retrieving data... </strong>
</apex:facet>

<apex:facet name="stop">

<apex:pageblockTable value="{!cAccounts}" var="c" id="results">
<apex:column >
<apex:facet name="header">
<apex:inputCheckBox value="{!selectAllCheckbox}">
<apex:actionSupport event="onclick" action="{!selectAll}" rerender="results"/>
</apex:inputCheckBox>
</apex:facet>
<apex:inputCheckBox value="{!c.selected}"/>
</apex:column>
<apex:column value="{!c.acct.Name}"/>
<apex:column value="{!c.acct.BillingCity}"/>
<apex:column value="{!c.acct.CreatedDate}"/>
<apex:column value="{!c.acct.LastModifiedDate}"/>
<apex:column value="{!c.acct.Id}"/>
</apex:pageblockTable>

</apex:facet>
</apex:actionStatus>
</apex:pageblock>
</apex:form>
</apex:component>

Controller:

public class resellerAccountSearch {

public String searchValue {get; set;}
public List<Account> results {get; set;}
public List<cAccount> cAccounts {get; set;}
public Boolean selectAllCheckbox {get; set;}

//Constructor
public resellerAccountSearch(){
results = new List<Account>();
cAccounts = new List<cAccount>();
}

public PageReference search(){
results.clear();
cAccounts.clear();

if(searchValue.length() > 1){
searchValue = '*'+searchValue+'*';

List<List<SObject>> searchList = [FIND :searchValue IN NAME FIELDS RETURNING Account(Id, Name, BillingCity, CreatedDate, LastModifiedDate order by LastModifiedDate desc )];
results = ((List<Account>)searchList[0]);

for(Account acct: results){
cAccounts.add(new cAccount(acct));
}
}
return null;
}

public PageReference selectAll(){
system.debug(selectAllCheckbox);
for(cAccount acct : cAccounts){
system.debug(acct.selected);

if(selectAllCheckbox == true){
acct.selected = true;
}else{
acct.selected = false;
}
}
return null;
}

public class cAccount{
public Account acct {get; set;}
public Boolean selected {get; set;}

public cAccount(Account a){
this.acct = a;
selected = false;
}
}

}


Thanks,
Jason

Message Edited by TehNrd on 01-22-2009 03:21 PM
  • December 15, 2008
  • Like
  • 0