• Mark Young
  • NEWBIE
  • 25 Points
  • Member since 2008

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 35
    Replies
I am trying to create a data entry page and I am having trouble with the save command button.  When I enter values I am getting the following error
 
Illegal view ID save. The ID must begin with /
  1. I have the following VF code
 
<apex:page standardController="Plan_Holding__c">
    <apex:Form >
        <apex:pageBlock title="Plan Holding Information">
            <apex:pageBlockButtons >
                <apex:commandButton action="save" value="Save"/>
            </apex:pageBlockButtons>
            <apex:pageBlockSection >
                <apex:inputField value="{!Plan_Holding__c.Plan__c}" >
                </apex:inputField>
                <apex:inputField value="{!Plan_Holding__c.As_of_Date__c}">
                </apex:inputField>
            </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:Form>
</apex:page>
Hi,
 
In Winter '09 is the {! $ObjectType.Account.fields.name.label} syntax no longer supported (even though it is still in VF docs)?
 
This syntax in some of my pages caused an internal server error, and then trying to build them wouldn't work ("invalid field 'fields' for SObject 'x')
 
Is there an alternative syntax?
 
Cheers,
 
Mark
Hi all,
 
VisualForce functionality appears to have changed today (20th EST) (tested on na2 and tapp0) in regards to multi-layered components and input fields.  This functionality definately used to work and now definately doesn't.  Repro is below:  Am I doing something wrong, or has a patch been rolled out?
 
We have quite a few areas where functionality within pages is encapsulated into components with the main object passed into these components.
What is happening below is that the field that is wrapped by the outputBlock is not returning the object value or saving it on postback.  So when clicking the button below this field will become blank, while the field that isn't wrapped will display correctly.
 
If we remove the attribute from the test component below and retrieve the value from a component controller it works fine.  However, this goes against much of this component structure.
 
 
Component 1 (OutputBlock):
Code:
<apex:component > 
    <apex:componentBody > 
    </apex:componentBody> 
</apex:component>

 

Component 2 (TestOutputBlockComponent):  This is the component that does most of the work:

Code:
<apex:component >
    <apex:attribute name="contact" type="Contact" description="Contact object passed from parent" required="true" />
    
    <apex:pageBlock title="Inputs">
        <apex:pageBlockButtons>
            <apex:commandButton value="save" />
        </apex:pageBlockButtons>
 
        <apex:pageBlockSection title="Fields with Validation" columns="1">
            <apex:pageBlockSectionItem>
                <apex:outputLabel value="First Name" for="firstname" />
                <c:OutputBlock>
                    <apex:inputField value="{!contact.FirstName}" id="firstname" />
                </c:OutputBlock>
            </apex:pageBlockSectionItem>
        </apex:pageBlockSection>
 
        <apex:pageBlockSection title="Fields without Validation" columns="1">
            <apex:inputField value="{!contact.LastName}" />
        </apex:pageBlockSection>
    </apex:pageBlock>
        
    <apex:pageBlock title="Values">
        {!contact.FirstName}<br />
        {!contact.LastName}
    </apex:pageBlock>
</apex:component>


Page:

Code:
<apex:page standardController="Contact">
    <apex:form>
        <c:TestOutputBlockComponent contact="{!contact}" />
    </apex:form>
</apex:page>


 
 


 
 
 
 


Message Edited by Mark Young on 08-20-2008 09:15 PM
Hi all,
 
Has anyone tried to use action regions inside components before?  We've got a large page which is split using tabs with the body of each tab provided by a component.  In order to optimise performance (which was very slow) I have been playing with actionRegions, extensive use of variables etc.
 
I've found that if an actionRegion is used in conjunction with a component, then fields inside that component don't seem to correctly display the value retrieved from the controller, even though the 'get' methods are being called.
 
For example... I whipped up the following demo page:
Code:
<apex:page controller="TestRepeat_Controller">
    <apex:form >
    
        <apex:actionRegion >
        <apex:pageBlock id="topSection">
            <apex:pageBlockButtons >
                <apex:commandButton value="Click Me" rerender="bottomSection" />
            </apex:pageBlockButtons>
            <apex:inputText value="{!input1}" />
        </apex:pageBlock>
        </apex:actionRegion>
        
        <apex:pageBlock id="bottomSection">
            <apex:outputText value="{!Current}" />
        <br />
            
            <apex:outputText value="{!input1}" />
        </apex:pageBlock>    
    </apex:form>

</apex:page>

 

Controller:

Code:
public class TestRepeat_Controller
{
    private String input1;
    
    public String getInput1()
    {
        return input1;
    }
    
    public void setInput1(String val)
    {
        input1 = val;
    }
    
    
    public String getCurrent()
    {
        return Datetime.now().format();
    }
}


This works great, the time shows up down the bottom along with the input from the top field.

However, if I extract the body of the page into a component and include the component then the time no longer shows after a postback (the input value does though).

Am I doing something wrong here?


 
 
Hi,
 
This has been plaguing me for a couple of hours, and finally seemed to have tracked down what seems to be a bug.
 
The following code is able to reproduce my issue (create a visualforce page and copy code into it):
Code:
<apex:page standardController="Account">
<apex:form>
<apex:outputPanel id="panel1">
 <apex:commandLink rerender="panel1" value="Update panel1" />
 <table><tr>
 <apex:repeat value="{!account.Contacts}" var="act">
  <apex:outputPanel>
  <td>Bob - {!NOW()}</td>
  </apex:outputPanel>
 </apex:repeat>
 </tr></table>
</apex:outputPanel>

<apex:outputPanel id="panel2">
 <apex:commandLink rerender="panel2" value="Update panel2" />
 <table><tr>
 <apex:repeat value="{!account.Contacts}" var="act">
  <td>Fred - {!NOW() }</td>
 </apex:repeat>
 </tr></table>
</apex:outputPanel>
</apex:form>
</apex:page>

 
When clicking the second link, all is well - the panel updates and the date changes.  However, when clicking the first (with an extra output panel), I get an internal server error (such as  Error ID: 92002686-78 (-1498298025)).
 
When doing a normal postback (i.e. not using rerender) there isn't any issue.
 
I use outputPanel's reasonably frequently to show / hide blocks of html, so this is quite important.
 
Any ideas?
Hi,

When performing a database insert, I'm only able to get back the first custom validation error.  Is there any way to get them all back?  Documentation says that all validation rules are evaluated.

I'm currently doing the following:
Code:
Contact c = new Contact();
Database.SaveResult result = Database.insert(c, false);

// Have multiple rules requiring fields to be set
System.debug('Num errors: ' + result.getErrors().size());  // Returns 1

 This should return all errors back, or else users are forced to do multiple round trips.

Any way to do this?

Thanks

Hi,

As part of VisualForce development we wanted to be able to incorporate standard object validation messages.

Because these pages are part of a wizard, we are using a temporary object which doesn't ever get saved (at the end of the wizard it gets transformed into other objects).  Each page we need to determine if input is valid, and instead of using custom coded validation, it would be nice to be able to use object validation.

What I've really like would be a method that says 'testValidationRules()' or 'testSave()'.

Currently we're using code like...
Code:
boolean success = false;

Savepoint sp = Database.setSavepoint();
try
{
    insert obj;
    success = true;
}
catch (DmlException ex)
{
    ... render and process errors ...
}
Database.rollback(sp);

 This all works great, except for pages which then go and do a Callout (get the 'You have uncommitted work pending. Please commit or rollback before calling out' message).

So...
  • Is there a way to fire validation rules without saving the object?
  • Is there any way to get around the Callout issue above (i.e. even though I am rolling back database changes it still complains)?
Thanks
I can't seem to get the soap xml displayed for callouts inside the System Log inside our sandbox (v13).  The same calls display the soap messages correctly in my na2 developer instance (v12).

I'm setting the 'Callout' log category level to 'Info'

Do I need to do something else to display this?
Hi,

I've written a wizard for updating a custom object.

What I cannot see to do is call the wizard with a parameter that - when passed - will set the an object variable within the wizard.

For example. i have a custom object; Flight__c. On a particular flight's detail page, I want to add a button that will call a custom visualforce page with that flight's id passed as a parameter. eg: na6.salesforce.com/apex/testpage?id=00000SA1Q

In that page - testpage - there is a form that will allow some of that record's values to be edited:

Code:
<apex:page controller="bookingWizController">
  <apex:sectionHeader title="Confirm Flight Booking" subtitle="Step 0 of 7"/>
    <apex:form >
      <apex:pageBlock title="Define Flight Name" mode="edit">
        <apex:pageBlockButtons >
            <apex:commandButton action="{!step1}" value="Next"/>
        </apex:pageBlockButtons>
        <apex:pageBlockSection title="Test set Flight">
            <apex:outputField id="flight" value="{!flight.name}"/>
        </apex:pageBlockSection>
        <apex:pageBlockSection title="Test pick account">
            <apex:inputField id="account" value="{!flight.Flight_Account__c}" required="true"/>
        </apex:pageBlockSection>        
        <apex:pageBlockSection title="Test pick dep airport">
            <apex:inputField id="dep_airport" value="{!flight.Flight_departure_airport__c}" required="true"/>
        </apex:pageBlockSection>     
        <apex:pageBlockSection title="Test pick arr airport">
            <apex:inputField id="arr_airport" value="{!flight.Flight_arrivals_airport__c}" required="true"/>
        </apex:pageBlockSection>
    </apex:pageBlock>
  </apex:form>
</apex:page>

and the controller get:

Code:
   public Flight__c getFlight() {   
      if(flight == null) flight = new Flight__c();
      return flight;
   }

 
and the rest of the methods are for various 'prev', 'next' and 'save' buttons - together with getters and setters for other objects. I just can't see where the flight can be initially set from the id paramater.

I'm probably missing something obvious - so a pointer would be really appreciated.

Thanks
 

  • September 20, 2008
  • Like
  • 0

I've tweaked and reloaded a stylesheet a half-dozen times, working to get the layout "just perfect".  It's kinda cumbersome to have to reload the CSS file from your local machine every time you make a modification to it.

Wouldn't it be cool if you could create custom CSS files from Visualforce?  And edit / save them directly from the Visualforce page editor, too?

Great idea, fancis_gibbons!  Vote: http://ideas.salesforce.com/article/show/10091352/Allow_stylesheets_to_be_created_and_edited_like_Visualforce_pages

I have a custom object with a 1-to-1 relationship with the Contact object via a lookup field.  I want to create a Visualforce page that shows the Contact detail section on top and the customObj__c detail section below it.  I know that I could work around it by using the Contact standard controller for the page and then lay out my custom object's fields by hand, but it would be fantastic if it were possible to do this using standard controllers for both, since that would allow the page layout tool to be used (and different layouts per record type, etc).
 
I'm still pretty new to Visualforce and custom controllers, extensions, and components.  I thought maybe I could get this to work by putting an <apex:detail> section in a custom component.  The first problem is that it appears there's no way to have a component use a standard controller.  Secondly, when the component is included in the main Contact page, the <apex:detail> section takes on the scope of the Contact record, rather than pull from the controller of the component.
 
I guess I'm essentially trying to put together a sort of "Console" type of functionality where multiple detail sections are present and they relate to the main Contact record.  Is this possible using Visualforce?
 
Thanks,
Jeff
 

I need suggestions from the pros - every time I start implementing a possible solution, I run into problems.

I have License object, with License Feature child object. (A software license, on which one or more license features can be added to increase the product capabilities.)

The license feature names come from a list in my controller. Here is what I would like my form to look like: (check to toggle date box)

License Name:
Feature NameExpiration Date
Feature A
Feature B
Feature C

Upon save, the License object would be created, as well as those features which are CHECKED. I can do this very easily if I code for each license feature independently. However, being the good programmer that I am, I am looking to write the code for the quickest implementation of future additional features. All I would do is add an item to a List of features, and the rest would auto-generate. Here is my latest attempt:

Page Snippet:
<apex:dataTable columns="2" value="{!AllLicenseFeatures}" var="feature">
  <apex:column>
    <apex:facet name="header">Available Features</apex:facet>
    <apex:inputCheckbox value="{!feature.name}" id="feature{!feature.name}" onChange="toggle('feature{!feature.name}Expiration')" />
  </apex:column>
  <apex:column>
    <apex:facet name="header">Expiration Date</apex:facet>
    <apex:InputField id="feature{!feature.name}Expiration" value="{!feature.Expiration_Date__c}" />
  </apex:column>
</apex:dataTable>
 

Current Problem: variable from the apex:dataTable tag is not usable in the apex:InputField or apex:InputCheckbox - it is looking for a controller class called feature, instead of using the variable.

Error messages returned by the compiler:

Error Error: id="feature{!feature.name}" core.apexpages.quickfix.QuickFixException: Unknown property 'newLicenseController.feature' Quick Fix Create Apex method 'newLicenseController.getFeature'

Error Error: Unknown property 'newLicenseController.feature'

How do I get those apex tags to refer to the dataTable variable feature, not a controller method feature!?

Controller Snippet:
List<String> feature_names = new List<String>{'Feature A','Feature B','Feature C'};
License_Feature__c[] features = new License_Feature__c[feature_names.size()];

public License_Feature__c getLicenseFeature(Integer i){
   if (features[i] == null) features[i] = new License_Feature__c();
   return features[i];
}
public License_Feature__c[] getAllLicenseFeatures() {
   integer i;
for ( i = 0; i < feature_names.size() ; i ++) { features[i] = getLicenseFeature(i); features[i].name = feature_names[i]; } return features; }
 


Message Edited by EricVlach on 09-11-2008 12:24 PM
Hi

I'm using a simple standard selectRadio Visualforce component, with selectOptions inside, just like that documented in the Visualforce developer's guide (and online help). However, I can't find any attribute on either of these components that lets me specify the default button.

In particular, I display a rating, 1 2 3 4 5. Currently it defaults to 5, which is fatal.

How do I specify which option will be the default? Am I missing something?

Thanks!
Jon
Hi,

I have a situation where I need to dynamically set the default tab in a tab panel. I have a parameter in my controller that I'm trying to use but for some reason the default tab isn't being set. If I hard code the name of the tab it works but once I try to use a visual force parameter the default tab doesn't get set properly. Here's sample code that illustrates the problem:

Code:
public class TabTest {


 public String ActiveTab {get; set;} 
 
 
 public TabTest() {
  this.ActiveTab = 'Tab2'; 
 }


}

Code:
<apex:page controller="TabTest">
 <apex:tabPanel switchType="client" selectedTab="{!ActiveTab}" id="slipTabPanel">
    <apex:tab label="Tab 1" name="tab1" id="tab1">
      Tab1
    </apex:tab>
    <apex:tab label="Tab 2" name="tab2" id="tab2">
      Tab2 
    </apex:tab>
    <apex:tab label="Tab 3" name="tab3" id="tab3">
      Tab3
    </apex:tab>
 </apex:tabPanel>
</apex:page>

 If I hard code to selectedTab="tab2" then it works fine but if I try to use a controller parameter it doesn't work. Any ideas what I might be doing wrong?
 

  • September 10, 2008
  • Like
  • 0
Hi,

I am trying to determine if it is possible to determine the static resource dynamically.

So e.g. I have 2 users who have alias of User1 and User2. I have 2 images User1.jpg and User2.jpg and they should see their corresponding image when they view the visualforce page.

I want to do something like
$Resource.($User.Alias).jpg

But I can't get the syntax right if it is at all possible.

Any advice appreciated. Thanks


Message Edited by danielfnz on 09-01-2008 03:18 AM
Relatively new to VF and not clear on how to do this.  Now that I have my page built, when someone clicks on the record id for my custom object I want the VF page brought up and not the standard Salesforce page.  How/where do I specify this change?
Hi,
 
I have a very basic question in Visualforce. I need to have a parameter in the VF page, assign a value to it using javascript and then retrieve the parameter values from the controller.
 This is my part VF code:
 
Code:
<apex:page controller="conLeadTab" action="{!validate}">
<apex:pageBlock id="mypageblock" mode="new">
                 <apex:param id="vesg"   name="vesg" value=""/>
     </apex:pageBlock>
<script language="javascript">
var vesgval = 'SOme value';
//The line below does not work, but here I need to assign the value of vesgval to the parameter vesg
//{!$CurrentPage.parameters.vesg}=vesgval;
</script>  
</apex:page> 

 

   
//My controller method 
 
Code:
  public PageReference validate() {
      this.pesgval = System.currentPageReference().getParameters().get('vesg');
      System.debug('this.pesgval--->>>'+this.pesgval);
               if(pesgval==null || pesgval.length()==0){
                    PageReference secondPage1 = new PageReference('/apex/editLeadError');
                        secondPage1.setRedirect(true);
                  return secondPage1; 
                  
                 } else{//do something else, but the execution never comes here as the value of pesgval is always NULL}          
            return null;      
                }

 
The system.debug in the controller for this.pesgval always return null and the value is not fetched from the VF page.

All that I am struggling to achieve here is:
1. Creating a parameter (not query string) in the VF page
2. Assigning a value to it within javascript on pageload
3. Retrieving the parameter value from the controller
 
Appreciate if anyone can give their feedbacks on this or send some sample code for the same.
Thanks and regards,
Rasu
  • August 28, 2008
  • Like
  • 0
Hi
 
I have created two visual force page, one named "giftcert" and another is "invoice"
 
I have created one command button on "invoice" page and click of that command button i want to open "giftcert" page as a pop up page.
 
VF Code:
 
<apex:page Controller="POSInvoice" tabStyle="POS__c">
<!-- Start page content -->
<script type="text/javascript">
function openpopup()
{
    window.open("/apex/giftcert","GiftCertificate","width=670,height=480"); //+pageURL,"Sell Gift Certificate","height=250,width=350");
}
</script>
<apex:form >
<apex:commandButton action="openpopup()" value="Sell Gift Certificate"/>
</apex:form>
but its not working..
any suggestion? any idea?
 
 
 
Hi,

I am using Outputpanel tag just after repeat tag. Doing this gives me "An internal server error has occurred". My code looks like:

Code:
<apex:repeat value="{!Test}" var="t">
 <apex:outputpanel layout="block" rendered="{IF(t.val,true,false)}">
      <tr>
   <td colspan="2" >
    {!t.Name}
   </td>
  </tr>
 </apex:outputpanel>
</apex:repeat>
I have a table in which i want to show the rows only on some condition. There is more formatting on the table which i have removed from above example and due to some extensive formatting i am not using datatable.

Is there any other way around?

GM
 

  • August 22, 2008
  • Like
  • 0
I am trying to create a data entry page and I am having trouble with the save command button.  When I enter values I am getting the following error
 
Illegal view ID save. The ID must begin with /
  1. I have the following VF code
 
<apex:page standardController="Plan_Holding__c">
    <apex:Form >
        <apex:pageBlock title="Plan Holding Information">
            <apex:pageBlockButtons >
                <apex:commandButton action="save" value="Save"/>
            </apex:pageBlockButtons>
            <apex:pageBlockSection >
                <apex:inputField value="{!Plan_Holding__c.Plan__c}" >
                </apex:inputField>
                <apex:inputField value="{!Plan_Holding__c.As_of_Date__c}">
                </apex:inputField>
            </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:Form>
</apex:page>
Hi all,
 
VisualForce functionality appears to have changed today (20th EST) (tested on na2 and tapp0) in regards to multi-layered components and input fields.  This functionality definately used to work and now definately doesn't.  Repro is below:  Am I doing something wrong, or has a patch been rolled out?
 
We have quite a few areas where functionality within pages is encapsulated into components with the main object passed into these components.
What is happening below is that the field that is wrapped by the outputBlock is not returning the object value or saving it on postback.  So when clicking the button below this field will become blank, while the field that isn't wrapped will display correctly.
 
If we remove the attribute from the test component below and retrieve the value from a component controller it works fine.  However, this goes against much of this component structure.
 
 
Component 1 (OutputBlock):
Code:
<apex:component > 
    <apex:componentBody > 
    </apex:componentBody> 
</apex:component>

 

Component 2 (TestOutputBlockComponent):  This is the component that does most of the work:

Code:
<apex:component >
    <apex:attribute name="contact" type="Contact" description="Contact object passed from parent" required="true" />
    
    <apex:pageBlock title="Inputs">
        <apex:pageBlockButtons>
            <apex:commandButton value="save" />
        </apex:pageBlockButtons>
 
        <apex:pageBlockSection title="Fields with Validation" columns="1">
            <apex:pageBlockSectionItem>
                <apex:outputLabel value="First Name" for="firstname" />
                <c:OutputBlock>
                    <apex:inputField value="{!contact.FirstName}" id="firstname" />
                </c:OutputBlock>
            </apex:pageBlockSectionItem>
        </apex:pageBlockSection>
 
        <apex:pageBlockSection title="Fields without Validation" columns="1">
            <apex:inputField value="{!contact.LastName}" />
        </apex:pageBlockSection>
    </apex:pageBlock>
        
    <apex:pageBlock title="Values">
        {!contact.FirstName}<br />
        {!contact.LastName}
    </apex:pageBlock>
</apex:component>


Page:

Code:
<apex:page standardController="Contact">
    <apex:form>
        <c:TestOutputBlockComponent contact="{!contact}" />
    </apex:form>
</apex:page>


 
 


 
 
 
 


Message Edited by Mark Young on 08-20-2008 09:15 PM
In http://wiki.apexdevnet.com/index.php/Tabbed_Accounts_in_30_seconds
I've done the same for my custom object and it works pretty good.
On mine I have defined  TAB-A, TAB-B, TAB-C
I have extension controller code getting called on one of my extra Tabs (TAB-B) and that works fine too.

However I want it to return the user exactly where they were (in TAB-B) but I cannot find what that tab reference/url is.
It appears to be a Frame with a hidden field (j_id0:CaseTabPanel=TAB-B)

Any ideas on how I'd re-render that back from my controller (via PageReference ?)

Thanks
Lal