• robertcw777
  • NEWBIE
  • 204 Points
  • Member since 2012

  • Chatter
    Feed
  • 8
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 29
    Questions
  • 42
    Replies
I am putting out a table with variable columns, so I need to do in html. When the table is rendered, it extends past the edge of the salesforce header. I've tried to adjust the column width in the <th> row by setting each column to 10% but can't seem to adjust any column widths. What is causing the table to go beyond the right margin of the header and how can I adjust it? Any help much appreciated.

Below is the VF, and the class definitions for the row wrapper follows that.

<apex:form >
  <apex:pageBlock id="budget">

      <apex:panelGrid columns="4" cellSpacing="10px">
         <apex:selectList label="Competency Owner" value="{!selectedCompetencyOwner}" size="1">
             <apex:selectOptions value="{!Owners}"/>
         </apex:selectList>
         <apex:commandButton value="Update" rerender="practices,budget"/>
         <apex:commandButton value="Resource Level" />
         <apex:commandButton value="Save"/>       
       </apex:panelGrid>

  <table class="list" border="0" cellpadding="0" cellspacing="0">
    <tr class="headerRow  ">
      <apex:repeat value="{!Headings.cellList}" var="h">
        <th width="10%">
           {!h.value}
        </th>
      </apex:repeat>
    </tr>

     <tr>
        <td align="right">
            {!InputLabel}
        </td>
       
         <apex:repeat value="{!inputRow.cellList}" var="i">        
            <td>
               <input type="text" value="{!i.value}" align="right"/>
           </td>
         </apex:repeat>
      
      </tr> 

   <apex:repeat value="{!Rows}" var="row">
       <tr>
         <apex:repeat value="{!row.cellList}" var="c">        
           <td align="right">
               {!c.value}
           </td>
         </apex:repeat>
       </tr>
    </apex:repeat>

  </table>
  </apex:pageBlock>
</apex:form>
</apex:page>

Row wrapper:

public class rowWrapper {
    public List<Cell> CellList{get;set;}
}


public class Cell {
    public String Value{get;set;}
    }
How do I embed double quotes inside a visualforce !IF statement? 


{!IF(l.Name=="Dallas Factory","google.maps.event.trigger(marker, "click");","")}

I get a missing ")" error when I put "click" in double quotes.

Help appreciated.

I have multilevel selectOptions so the user can select Region, Country, StateProvince and City. I rerender each when the parent selection changesl. However, it only changes the first child of the parent. For example, if the values are "North America, US, TX, Dallas" and then change to Country to Canada, the StateProvince selections change, but the City does not rerender. Also, sometimes I click on the child field and see that it is incorrect. But when I click again, it has been changed to the correct values.

 

Any help appreciated. Here is my code (note that each geography has an "All" record as a valid selection).

 

<apex:page standardcontroller="CompetencyOwner__c" Extensions="CompetencyOwnerExt">
    <apex:form >
       <apex:pageBlock >
           <apex:PageMessages />
           <apex:commandButton value="Save" action="{!save}"/>
           <apex:commandButton value="Cancel" action="{!cancel}"/>
          <apex:pageBlockTable var="c" value="{!CompetencyOwner__c}" title="Assign Regions">
             <apex:column headerValue="Owner">
                 <apex:selectList value="{!selectedRole}" size="1" required="True" Style="width:150px">
                     <apex:selectOptions value="{!Roles}"/>
                 </apex:selectList>
              </apex:column>
             <apex:column headerValue="Region">
                 <apex:selectList value="{!selectedRegion}" size="1" required="True" Style="width:150px">
                     <apex:selectOptions value="{!Regions}"/>
                     <apex:actionSupport event="onchange" rerender="countryID"/>
                 </apex:selectList>
              </apex:column>
<apex:column headerValue="Country"> <apex:selectList value="{!selectedCountry}" id="countryID" size="1" required="False" Style="width:150px"> <apex:selectOptions value="{!Countries}"/> <apex:actionSupport event="onchange" rerender="stateprovinceID"/> </apex:selectList> </apex:column> <apex:column headerValue="State/Province"> <apex:selectList value="{!selectedStateProvince}" id="stateprovinceID" size="1" required="False" Style="width:150px"> <apex:selectOptions value="{!StateProvinces}"/> <apex:actionSupport event="onchange" rerender="cityID"/> </apex:selectList> </apex:column> <apex:column headerValue="City"> <apex:selectList value="{!selectedCity}" id="cityID" size="1" required="False" Style="width:150px"> <apex:selectOptions value="{!Cities}"/> </apex:selectList> </apex:column> </apex:pageBlockTable> </apex:pageBlock> </apex:form> </apex:page>


Controller:

public class CompetencyOwnerExt{


  //note that this code depends upon each geography(region, country,state,city) 
 //having a record entry named "All"

   Public CompetencyOwner__c CompOwner;
    
    public String SelectedRole {get;set;}
    public String SelectedRegion{get;set;}
    public String SelectedCountry{get;set;}
    public String SelectedStateProvince {get;set;}
    public String SelectedCity {get;set;}
     
    private final CompetencyOwner__c custobj;
    private ApexPages.StandardController controller;
    //create a constructor that extends the standard controller
    public CompetencyOwnerExt(ApexPages.StandardController controller){
        this.controller=controller;
        this.custobj=(CompetencyOwner__c)controller.getrecord();

        
        String CompOwnerID=ApexPages.CurrentPage().getparameters().get('ID');
        CompOwner=[Select Name, OwnerRole__c,OwnerRoleID__c,Region__c,Country__c,StateProvince__c,City__c
                   From CompetencyOwner__c where ID=:CompOwnerID];
                                                         
        if(CompOwner==null) {
           //this is a new competency owner
           CompetencyOwner__c newComp=new CompetencyOwner__c();
           insert newComp;
           }
        else {           
            //set presets from database
            selectedRegion=CompOwner.Region__c;
            selectedCountry=CompOwner.Country__c;
            selectedStateProvince=CompOwner.StateProvince__c;
            selectedCity=CompOwner.City__c;
            }         
    } //end constructor
    
 
 /*********  Regions  *********/       
    public List<selectOption> getRegions() {
            
        List<SelectOption> regionOps=new List<SelectOption>();
        List<Region__c> regionList=[Select Name from Region__c Order by Name];
        for(Region__c r:regionList) {
            regionOps.add(new SelectOption(r.ID,r.Name));
        }
     }
 
    public String getSelectedRegion() {
        return SelectedRegion;
    }
           
    public void setSelectedRegion(String SelectedRegion)  {
        System.debug(LoggingLevel.INFO,'??????????????? selected region set'+SelectedRegion);
        this.SelectedRegion=SelectedRegion;
    }
 /*********  End Regions  *********/    

 /*********  Countries  *********/        
    public List<selectOption> getCountries() {       
        List<selectOption> CountryOps=new List <selectOption>();
        List<Country__c> CountryList;
        Country__c allCountries=[Select Name from Country__c Where Name='All' and Region__c=:selectedRegion Limit 1];
        countryOps.add(new selectOption(allCountries.id,allCountries.Name));
        CountryList=[Select Name from Country__c Where Region__c=:selectedRegion Order by Name];
        for(Country__c co:CountryList) {
            if(co.id!=allCountries.id) {
                countryOps.add(new selectOption(co.id,co.Name)); //All value already added
                }
            } //end for
        
    return countryOps;
    }  //end getCountries
    
    public String getSelectedCountry() {
        return SelectedCountry;
    }
           
    public void setSelectedCountry(String SelectedCountry)  {
        this.SelectedCountry=SelectedCountry;
    }
 /*********  end Countries *********/
    
 /*********  State Provinces  *********/        
    public List<selectOption> getStateProvinces() {
        List<selectOption> stateProvinceOps=new List <selectOption>();
        List<State_Province__c> stateProvinceList;
         //get ID for All selection
        State_Province__c allStateProvinces=[Select Name from State_Province__c Where Name='All' and Country__c=:selectedCountry Limit 1];
        stateProvinceOps.add(new selectOption(allStateProvinces.id,AllStateProvinces.Name));
        stateProvinceList=[Select Name from State_Province__c Where Country__c=:selectedCountry Order by Name];
        for(State_Province__c sp:stateProvinceList) {
            if(sp.id!=allStateProvinces.id) {
                stateProvinceOps.add(new selectOption(sp.id,sp.Name));
                }
          }
 
       return StateProvinceOps;
    }  //end getStateProvinces
      
    public String getSelectedStateProvince() {
        return SelectedStateProvince;
    }
           
    public void setSelectedStateProvince(String SelectedStateProvince)  {
        this.SelectedStateProvince=SelectedStateProvince;
    }

/*********  Cities  *********/        
    public List<selectOption> getCities() {
  
        List<selectOption> CityOps=new List <selectOption>();
        List<City__c> CityList;
         //default for cityList is All
        City__c allCities=[Select Name from City__c Where Name='All' and StateProvince__c=:selectedStateProvince Limit 1];
        cityOps.add(new selectOption(allCities.id,allCities.Name));        
        cityList=[Select Name from City__c Where stateProvince__c=:selectedStateProvince Order by Name];
        for(City__c ci:cityList) {
            if(ci.id!=allCities.id) {
               cityOps.add(new selectOption(ci.id,ci.Name));
               }
            }
        return CityOps;
    }  //end getCities
      
    public String getSelectedCity() {
        return SelectedCity;
    }
           
    public void setSelectedCity(String CityProvince)  {
        this.selectedCity=SelectedCity;
    }



 

My VF page opens a google map and adds multiple locations based on an list returned from the controller. The markers display fine with the correct names displayed on the mouseover. However, whenever I click to view the infoWindow, it always opens the infowindow for the last location added. Can anyone see what I'm doing wrong?

 

Thanks.

 

 

<apex:page Controller="LocationMapController2">

<head>

<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script type="text/javascript">

$(document).ready(function() {

var myOptions = {
   zoom: 2,
   mapTypeId: google.maps.MapTypeId.ROADMAP,
   center: new google.maps.LatLng(40,-95),
   mapTypeControl: false
}

var map;
var marker;

//create map
map = new google.maps.Map(document.getElementById("map"), myOptions);

var geocoder = new google.maps.Geocoder();


<apex:repeat var="l" value="{!LocationInfo}">

   var address = "{!l.Street__c}, " + "{!l.City__r.Name}, " + "{!l.City__r.Name}, " + "{!l.Country__r.Name}";

   var infowindow = new google.maps.InfoWindow({
content: "<b>{!l.Name}</b><br>{!l.Street__c}<br>{!l.City__r.Name}, {!l.City__r.Name}<br>{!l.Country__c}"
   });

   geocoder.geocode( { address: address}, function(results, status) {
   if (status == google.maps.GeocoderStatus.OK && results.length) {
      if (status != google.maps.GeocoderStatus.ZERO_RESULTS) {
         //create marker
         marker = new google.maps.Marker({
         position: results[0].geometry.location,
map: map,
         title: "{!l.Name}"
         });

         //add listeners
         google.maps.event.addListener(marker, 'click', function() {
         infowindow.open(map,marker);
         });
         google.maps.event.addListener(infowindow, 'closeclick', function() {
map.setCenter(marker.getPosition());
         });
   }
} else {
   $('#map').css({'height' : '15px'});
   $('#map').html("Oops! {!l.Name}'s address could not be found, please make sure the address is correct.");
   resizeIframe();
}
});

</apex:repeat>

function resizeIframe() {
   var me = window.name;
      if (me) {
        var iframes = parent.document.getElementsByName(me);
         if (iframes && iframes.length == 1) {
             height = document.body.offsetHeight;
            iframes[0].style.height = height + "px";
        }
 }
}

});
</script>

<style>
#map {
font-family: Arial;
font-size:12px;
line-height:normal !important;
height:500px;
background:transparent;
}
</style>

</head>

<body>
<div id="map"></div>
</body>
</apex:page>

I'm using VF charting to display a gauge on a page. I can't see anyway to set different colors for upper and lower bounds on the gauge face. For example, I want to have the gauge show a range or -100 to +100, and have the gauge face show up as green between +/- 20, Yellow between 20 and 40 and -20 and -40,  and red outside those limits. I know you can set color sections like this on the saleforce dashboard gauage, but can't see any way to do in VF. I can set two colors in the apex:gaugeSeries so that it shows one color left of the needle and another above the needle, but I need to have a static display with different colors on the gauge face itself. Appreciate if someone knows if this can or can't be done.

 

 

I have a visualforce page that shows charts that I would like to filter based on a filter header  settings. For example, when the user selects a specific Country, the charts will be rerendered for just that country data.  Below is the controller for the filter page showing the dropdown values. Below that is the master page that includes the filter page, and other visualforce pages that display the charts, each with its own controller. How can I share the value of the dropdown selection wiht the controllers for the included pages?

 

Thanks!

 

public with Sharing class PracticeFilterClass{

 

// public List<SelectOption> Filter {get;set;}
 
public String SelectedFilter{get;set;}
public String SelectedRegion{get;set;}
public String SelectedCountry{get;set;}
public String SelectedStateProvince{get;set;}
public String SelectedCity{get;set;}
public String SelectedRole{get;set;}

 

etc...

 

VisualForcePage:

 

<apex:page >
<apex:include pageName="FilterHeaderPage"/>
<apex:include pageName="MyDashboardInfo"/>
<apex:include pageName="MyDashboardRow2"/>
</apex:page>

 

 

 

I have set up a VF page to replace the edit page for a custom object “CompetencyOwner__c”.  The object contains two fields “Region__c” and “Country__c” which I want to be able to let the user change with selectLists.  I have no problem building the selectOption values and making the Country values dependent on the selected Region. My problem is that I don’t understand how to set the default value of the dropdowns based on the current record values of those fields.

 

I have a getter method to return the list of selectList values to populate the dropdowns. I also have getter and setter methods for the current value of the selection. Here’s an example for the Region field:

 

  String selectedRegion;  //for selected value

 

    public List<selectOption> getRegions() {

        List<SelectOption> regionOps=new List<SelectOption>();

        List<Region__c> regionList=[Select Name from Region__c Order by Name];

        for(Region__c r:regionList) {

            regionOps.add(new SelectOption(r.ID,r.Name));

        }

        return regionOps;

    }

 

    public String getSelectedRegion() {

        return SelectedRegion;

    }

          

    public void setSelectedRegion(String SelectedRegion)  {

        this.SelectedRegion=SelectedRegion;

    }

 

Assume I can get the actual record to be edited. How do I set the initial value of the dropdown to the selectOption that corresponds to the record ID or Name?

I have a puzzling problem where an outputlink is not rendering as a hyperlink to an VF page and nothing happens when I click on it, even though it appears that the html is rendering correctly.

 

See the outputlink in the VF column "Work" below::

 

<apex:page controller="MyWorkController">

  <apex:form>

    <apex:pageblock >

        <apex:pageblocktable value="{!WorkTable}"  var="w">

            <apex:column headervalue="Next Action">

                <apex:outputText value="{0,date,MM'/'dd'/'yyyy}" style="{!w.NextActionStyle}">

                              <apex:param value="{!w.NextActionDate}"/>

                </apex:outputText>

            </apex:column>

             <apex:column headervalue="Due Date">

                <apex:outputText value="{0,date,MM'/'dd'/'yyyy}" style="{!w.DueStyle}">

                              <apex:param value="{!w.DueDate}"/>

                </apex:outputText>

            </apex:column>

            <apex:column headervalue="Type">

                    <apex:outputtext value="{!w.WorkItemType}"/>

            </apex:column>

 

            <apex:column headervalue="Work">

                <apex:outputlink value="/{!w.WorkItemID}"/>

                       {!w.WorkItemName}

            </apex:column>  

           

        </apex:pageblocktable>

    </apex:pageblock>

    </apex:form>

 </apex:page>

 

Here is the html.

 

colspan="1"><a href="https://na14.salesforce.com/a0Kd00000036RrYEAU"></a>

                       Seattle P2 Audit</td>

 

and this link works if I copy and paste it into the browser (I’m using Firefox)

 

The VF page cell is just rendered as if it were just an outputtext field.

Any ideas?

I've done quite a bit of research on the forums on how to include a "simple" Google Map example, and have tried many of them. With all , I seem to end up in the same place as a lot of others end up based on the forum comments - the map never actually comes up. I have a valid API key that I substitute, and still nothing comes up - just a blank VF page. Does anyone have a real working example that I could review and modify?

 

 I just want to display a set of locations on the map. In my case, location is a custom object with country, state,city and zip (not a standard account record). If I can just get something basic working (i.e. actually see a map), I can then modify it to also set the marker colors based on some properties of the location - it's for a dashboard.

 

Any help would be greatly appreciated (something in API V3 would be best, but at least an example that works). I thought this was going to be simple...

I want to open a visualforce page from a custom button on a custom object detail page. The user selects a value in a tree dispayed in a VF page, and then clicks on a save button. I would like to update a record on the custom object, close the VF page, and then refresh the detail page so the record updates (updating the field itself would be better).

 

I've tried all kinds of solutions for similar situations on the web, but can't get any to work. Does someone know how to do this?

 

Thanks! 

 

Here is VF:

 

<apex:page id="CompetencyRolesPage" StandardController="Competency__c" Extensions="TestPageController">

    <apex:form >

       <apex:outputPanel rendered="{!validRoleID}">

           <c:TreeView selectable="true" roleOrUserId="{!RoleID}" value="{!selectedValues}" />

           <apex:commandButton value="Save" action="{!saveRole}" />

        </apex:outputPanel>

    </apex:form>

</apex:page>

 

Here arerelevant pieces from controller:

 

public String selectedValues {get; set;}

public String userRoleID {get;set;}

   

public Boolean getValidRoleID() {

      If(null==UserInfo.getUserRoleID())

         return false;

      else

        return true;

    }

           

    public String getRoleID() {

       userRoleId=UserInfo.getUserRoleID();

       return userRoleID;

    }

   

    public PageReference saveRole() {

       //will update customer field in detail record here.

        return null;

    }

Is there any way to fix a scale and scale interval on a visualforce chart? I'm plotting a bar series that looks like:

 

x           y

-30       1

-20       5

-10       8

+10      3

+20      4

+30      6

 

It anchors the vertical barchart y axis scale at 1 and the top at 9, therefore, there is no bar shown for the first point at x=-30. I guess in a series starting at x=0 you could add another element at 0,0, but that doesn't work here. I can' t see any way in the documentation to set the scale, I also have the case where they y-values need to be whole numbers, yet it shows the scale in increments of 0.5,

 

 

I have a  custom object Parent__c and child records Child__c. I want to show fields from the child record that corresponds with its parent record. But, I want the titles for each child column to appear only at the top of the Visualforce table. Like:

 

Parent Field TItle     Child Field 1 Title        Child Field 2 Title        Child Field 3 TItle

P1.Value                             P1.C1.Value                  P1.C1.Value                 P1.C1.Value

                                             P1.C2.Value                  P1.C2.Value                 P1.C2.Value

P2.Value                             P2.C1.Value                  P2.C1.Value                 P2.C1.Value

                                             P2.C2.Value                  P2.C2.Value                 P2.C2.Value                                                     

                                             P2.C3.Value                  P2.C3.Value                 P2.C3.Value

etc.

 

Does anyone know how to do this?

 

Thanks!

I need to group and display child object fields  by parent object fields in a nested VisualForce Pageblock. For example, Parent__c is the parent of Child__c. I'd like to display a table with the name of the parent in a row, and then show fields of Child__c for each name.

 

Parent         Child

 

Name1        Field1

                      Field2

                      Field3

Name2        Field1

                      Field2

                      Field3

etc.

 

 

I know how to do the parent child query in the controller:

 

List <Parent__c> ParentChildList{get;set;}

 

Public LIst <Parent__c> getQueryList() {

  ParentChildList = [Select Name,(Select Field1__c,Field2__c From Child__c) From Parent__c];

  return ParentChildList;

}

 

I'm having trouble with the nested PageBlock tables in the VisualForce page (using apex:facet) that reference the data returned by the controller to show the nested table above. Help would be much appreciated.

 

I have a custom object called Displine__c. I want to create a VF page that has a New button that will open the new record page for this object, and then rerender the page (there is a tableblock below that should be refreshed to show the new record). I couldn't find any way to do this. Help?