• cwall_sfdc
  • NEWBIE
  • 380 Points
  • Member since 2007

  • Chatter
    Feed
  • 14
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 158
    Replies

I'm trying to use new Input and InputField with type attribute. I need to use the date or datetime type as follow:

 

<apex:input value="{!birthdayDate}" type="date" styleClass="select-box"/>

 with corresponding controller:

 

public Date birthdayDate {
    get;
    set {
        System.debug('birthdayDate setter: ' + value);
        birthdayDate = value;
        currentAccount.PersonBirthdate = value;
    }
}

 

But when the user clears the field by clicking on the "x" button, the setter is not triggered and value cannot be reset.

I could use the inputField instead directly on PersonBithdate field, but I get an "Error: Invalid Date" when submitting the form.

FYI : I'm using API 29 (as requested by the Winter 14 release notes) for this files.

Thanks for your help.

 

  • November 01, 2013
  • Like
  • 0

Hi All,

 

I am using some highchart.js file to plot a graph on visualforce page, if i use hard code value to graph in js code then it is working fine but, if i use VF remoting to bring data from apex controller to plot graph, VF remoating bringing data from apex controler but jquery not ploting graph at all.

I am pasting my VF page code. Please help me on this...

 

VF page code:

 

<apex:page controller="ChartController">

    <apex:includeScript value="{!URLFOR($Resource.jQuery)}"/>
    <apex:includeScript value="{!URLFOR($Resource.HighChartJS, '/js/highcharts.js')}"/>
    <apex:includeScript value="{!URLFOR($Resource.HighChartJS, '/js/modules/exporting.js')}"/>
    <script type="text/javascript">
            var accountNames = [];
            var optNums = [];
            var optProbs = [];
            $(function() {
                
                 //VF remoating start
                Visualforce.remoting.Manager.invokeAction(
                    '{!$RemoteAction.ChartController.getRemoteData}',
                    function(result, event){
                        if (event.status) {
                        
                            for(var i=0; i<result.length; i++)
                            {
                                accountNames.push(result[i].name);
                                optNums.push(result[i].data1);
                                optProbs.push(result[i].data2);
                            }
                            
                            alert(accountNames);
                        } 
                        else {
                            //document.getElementById("responseErrors").innerHTML = event.message;
                            alert(event.message);
                        }
                    }, 
                    {escape: true}
                );
            
                //VF remoating end
            });
            $.when.apply($, accountNames).done(function() {
                
                $('#container').highcharts({
                    chart: {
                        type: 'line'
                    },
                    title: {
                        text: 'Monthly Average Temperature'
                    },
                    subtitle: {
                        text: 'Source: WorldClimate.com'
                    },
                    xAxis: {
                        categories: accountNames
                        //categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
                    },
                    yAxis: {
                        title: {
                            text: 'Temperature (°C)'
                        }
                    },
                    tooltip: {
                        enabled: false,
                        formatter: function() {
                            return '<b>'+ this.series.name +'</b><br/>'+
                                this.x +': '+ this.y +'°C';
                        }
                    },
                    plotOptions: {
                        line: {
                            dataLabels: {
                                enabled: true
                            },
                            enableMouseTracking: false
                        }
                    },
                    series: [{
                        name: 'Tokyo',
                        //data&colon; optNums
                        data&colon; [7.0, 6.9, 9.5, 14.5, 18.4, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6]
                    }, {
                        name: 'London',
                        //data&colon; optProbs
                        data&colon; [3.9, 4.2, 5.7, 8.5, 11.9, 15.2, 17.0, 16.6, 14.2, 10.3, 6.6, 4.8] 
                    }]
                });
            });
<table width="100%">
    <tr>
 <td width="50%">
     <div id="container" style="width: 500px; height: 500px;"></div>
 </td>
    </tr>
</table>
</apex:page>

 

 

I have a commandButton to reprocess a set of filters and on clicking Go, the page redraws the charts and tables. When the page first loads I process and display the charts on the page with no problem. When I click Go, all the charts and tables display except the bar chart.

 

I get this error in my browser console:

Visualforce Chart: Error loading configuration for chart 'jid0jid29jid55jid56jid57jid64': Did not find required field 'ftRev,tgtRev' in data for chart 'jid0jid29jid55jid56jid57jid64'. Make sure field was queried and/or provided and has a value.

 

 

Here are extracts from the page code:

...

<apex:commandButton action="{!updatePage}" value="Go" id="theButtonCM"/>

...

<apex:outputPanel id="barchart">
<apex:pageBlock >
<apex:pageBlockTable value="{!perfSummList}" var="d" align="center">
<apex:column value="{!d.ftRev}" headerValue="FT"/>
<apex:column value="{!d.tgtRev}" headerValue="tgt"/>
<apex:column value="{!d.monthYYYYMM}" headerValue="mth"/>
<apex:column value="{!d.monthStr}" headerValue="mth"/>
</apex:pageBlockTable>
<b>ft revenue vs target</b><br/>
<apex:chart data="{!perfSummList}" height="300" width="500">
<apex:legend position="bottom" spacing="10" padding="2" font="10px Helvetica"/>
<apex:axis type="Category" position="bottom" fields="monthStr">
<apex:chartLabel />
</apex:axis>
<apex:axis type="Numeric" position="left" fields="tgtRev,ftRev" minimum="0" >
<apex:chartLabel />
</apex:axis>
<apex:barSeries axis="left" orientation="vertical" xField="monthStr" yField="ftRev,tgtRev" title="F+T,Target">
<apex:chartLabel />
</apex:barSeries>
</apex:chart>
</apex:pageBlock>
</apex:outputPanel>

 

The data in the table is from the same list and shows up just fine - the fields reported have values as surely the table would show if they did not. Something is going on under the hood for the charts and I can find out the issue here.

 

Any ideas?

 

 

The salesforce.com docs states remoting methods can take the following values as arugments, "primitives, collections, typed and generic sObjects, and user-defined Apex classes...". There appears to be an issue with generic sObject. Take a look at the following Visualforce page and the related remoting method.

 

<apex:page showHeader="true" sidebar="true" controller="RemotingSObject">
	<input value="Click Me" onclick="doRemote();" type="button"/>

	<script type="text/javascript">
		
		function doRemote(){
			var obj = {
				sobjectType: 'Account',
				Name: 'My new account'
			};

			//You can see there is a value of sbojectType set
			console.log(obj);

			Visualforce.remoting.Manager.invokeAction('{!$RemoteAction.RemotingSObject.receiveSObject}', obj, function(result, event){
		        console.log(event);
		        console.log(result);
			});
		}

	</script>
</apex:page>

 The Class:

public with sharing class RemotingSObject {
	@RemoteAction
	public static void receiveSObject(SObject obj) {
		system.debug(obj); 
	}
}

 If you look in the browsers JavaScript console you will see this error message:

Visualforce Remoting Exception: Unable to determine SObject type: SObject. Please provide an 'id' or 'sobjectType' value.

 

Makes no sense as an sobjectType value is being supplied. Oddly enough if you provide an id value it works...but if you are trying to insert a new sObject you do not yet have an id value to use.

 

Any ideas on how to make this work? Bug?

 

Thanks,

Jason

 

  • February 05, 2013
  • Like
  • 1

Hello,

 

  I am using sencha and salesforce to build a mobile SDK. My app was working just fine for my part where I was able to query object from salesforce as well as insert. But after adding my co-worker's code into my project i get an error in the javascript console in my browser and I can longer naviaget to my page but only to his, but then when I go to his pages I can;t query any object. If I add my code to my co-worker it works just fine. Am i forgetting to configure something? The error is below.

 

  1. Visualforce Remoting Exception: No serializer found for class core.filemanager.FileBlobValue
  2. VFRemote.js:114
    1. $VFRM.Util.errorVFRemote.js:114
    2. (anonymous function)VFRemote.js:129
    3. a.Event.fireVFRemote.js:48
    4. a.Observable.fireEventVFRemote.js:43
    5. _Visualforce.Direct._Visualforce.extend.onProviderDataVFRemote.js:83
    6. a.Event.fireVFRemote.js:48
    7. a.Observable.fireEventVFRemote.js:43
    8. _Visualforce.direct.RemotingProvider._Visualforce.extend.onDataVFRemote.js:91
    9. _Visualforce.extend.handleResponseVFRemote.js:72
    10. (anonymous function)

I am working with visualforce charting. I have bars series that show information. I would like the bars on the chart to be grouped by name and for the bars to be side by side.

If you need anymore information from me please let me know.

 

<!-- Visualforce page: -->

<apex:page controller="ChartController">
<apex:form >
<apex:pageBlock >
    <apex:pageBlockSection columns="1">
        <apex:chart height="400" width="700" data="{!data}" >
            <apex:legend position="right"/>
            <apex:axis type="Numeric" position="right" fields="data1"  title="Revenue (millions)" grid="true"/>
            <apex:axis type="Category" position="bottom" fields="name"  title="Month of the Year">
                <apex:chartLabel rotate="315"/>
            </apex:axis>
            <apex:barSeries title="Data1" orientation="vertical" axis="right"  xField="name" yField="data1" colorSet="red" stacked="false">
                <apex:chartTips height="20" width="120"/>
            </apex:barSeries>
            <apex:barSeries title="Data2" orientation="vertical" axis="right"  xField="name" yField="data2" colorSet="green" stacked="false">
                <apex:chartTips height="20" width="120"/>
            </apex:barSeries>
            <apex:barSeries title="Data3" orientation="vertical" axis="right"  xField="name" yField="data3" stacked="false">
                <apex:chartTips height="20" width="120" />
            </apex:barSeries>
        </apex:chart>
    </apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>

<!-- Controller Code: -->

public class ChartController {
    // Return a list of data points for a chart 
    
    public List<Data> getData() {
        return ChartController.getChartData();
    }
    
    // Make the chart data available via JavaScript remoting 
    
    @RemoteAction
    public static List<Data> getRemoteData() {
        return ChartController.getChartData();
    }

    // The actual chart data; needs to be static to be 
    
    // called by a @RemoteAction method 
    
    public static List<Data> getChartData() {
        List<Data> data = new List<Data>();
        data.add(new Data('Jan', 30, 90, 55));
        data.add(new Data('Feb', 44, 15, 65));
        data.add(new Data('Mar', 25, 32, 75));
        data.add(new Data('Apr', 74, 28, 85));
        data.add(new Data('May', 65, 51, 95));
        data.add(new Data('Jun', 33, 45, 99));
        data.add(new Data('Jul', 92, 82, 35));
        data.add(new Data('Aug', 87, 73, 45));
        data.add(new Data('Sep', 34, 65, 55));
        data.add(new Data('Oct', 78, 66, 56));
        data.add(new Data('Nov', 80, 67, 53));
        data.add(new Data('Dec', 17, 70, 70));
        return data;
    }
    
    // Wrapper class 
    
    public class Data {
        public String name { get; set; }
        public Integer data1 { get; set; }
        public Integer data2 { get; set; }
        public Integer data3 { get; set; }
        public Data(String name, Integer data1, Integer data2, Integer data3) {
            this.name = name;
            this.data1 = data1;
            this.data2 = data2;
            this.data3 = data3;
        }
    }
}

 

Hi All

 

I am new to Developer Force. 

 

Therefore, my question may be a little fundamental.  But the question is an important question to support my initial undestanding of Force.com platform.

 

I am interested to know if it is actually possible to design a single version of a Mobile App on Force.com to run on the following platforms Andriod, Blackberry, PlayBook, iPhone and iPad ?

 

Thank you, in advance.

 

 

 

  • May 10, 2012
  • Like
  • 0

I get the following error when trying to access a controller Method from a VisualForce page: Visualforce Remoting Exception: only whitespace content allowed before start tag and not C (position: START_DOCUMENT seen C... @1:1)

 

Here is the Controller Class:

    @RemoteAction
    global static String saveUser(Credentials__c cred, Contact con) {
    	
    	cred.Lead_Number__c = integer.valueof(cred.Lead_Number__c);
        
        Http h = new Http();
        
/*
Initialize endpoint URL here
Code not included but works
*/
        
        HttpRequest req = new HttpRequest();
        req.setEndpoint(url);
        req.setMethod('GET');
        
        HttpResponse res = h.send(req);
        Dom.Document doc = res.getBodyDocument();
        DOM.XMLNode root = doc.getRootElement();
        //Parses returned XML to String
        String result = Global_Methods.walkThrough(root);
        return (result.length()>0 ? result:'Error');
    }


 

And here is my call from the VisualForce Page:


		Global_Methods.saveUser(rec,con, function(result, event){
			var res = result.split(",",2);
			res[0] = parseInt(res[0]);
			if(res[0]!=1){
			alert(res[1]);
			    deleteId(record.Id);
			    return false;
			}
			else {
				RegisterTrial(con,rec,subProducts,type);
			}
		}, {escape:true});

 

The odd thing is that this works fine from a different VF page. I have no idea what this error means or how to fix it. Any insight is very much apprechiated. Thanks!


Hi Guys,

 

Just want to know how to perform an Insert action in the Vf page using Jquery Mobile or how can you pass a parameter to the methods in your controller. What I did is a copy a text input value and use it as a parameter to pass into my method in which it uses the passed value to perform insert operation.

If you execute two javascript remoting calls in the same Javascript batch, those calls get lumped together as a single request and share an Apex context and governor limits.  For example:

 

function doSomething()
{
    controller.remoteCall1();
    controller.remoteCall2();
}

 Doing that will result in one remoting request instead of two.  This is especially problematic if one of those two calls is a call to a method marked as @ReadOnly and the other is not.  Is there a good way to get around this behavior?  Are calls only batched if they're executed within the same Javascript context/event or is there a peroid of time within which all calls are automatically batched?

 

I have had some success using setTimeout() to execute each call in it's own context, but I want to make sure this is a valid way to handle this.  Are there lmiits to the number of javascript remoting requests that can be made in parallel?

 

Thanks,

  • January 27, 2012
  • Like
  • 0

Hi,

 

Can i acess java script varible value in a VF page Controller Apex class.

 

Suppose in my VF page , a java script variable   " var a='some thing'" . Now i want to store this variable in a Apex Controller class varible...

 

Is it possible...?

 

  • October 17, 2011
  • Like
  • 0

The documentation for javascript remoting says, "Your method can take Apex primitives as arguments," and I'd like to pass a Javascript Date into my remoted function. Javascript Date has a time component, so it's analogous to an Apex DateTime.

 

However, when I pass in the Date from javascript calling my remoted function, the remoting javascript code throws an exception complaining that I'm not passing in a DateTime but rather the time as an ISO string. 

 

I noticed that in the opposite direction, DateTimes get marshaled as an integer of the number of milliseconds since the epoch (Jan 1, 1970), which javascript can use in a Date constructor, so I tried passing that in for the DateTime arg, but it still complained.

 

Is there a way to pass a Javascript Date directly to a remoted function as an Apex DateTime??

 

My workaround in the meantime was to accept the Date as an ISO string, replace the "T" with a space, and use the result to construct the Apex DateTime with DateTime.valueOf. It'd be nice to be able to skip this, though. 

 

Thanks,

--Kevin

Hi,

First of all, thank you for taking the time to try and help.

I have written a vf page with a custom controller. The purpose of this page is to allow users to create/edit/delete new/existing tasks. It's a long story - but this is what the client wants. The first thing I got working was to edit or view an existing task record, with inline editing in view mode. Then I started working on create. It took a very long time, but finally that too was working. Now just before showing my client the finished job, I double checked that view/edit existing task works, and when I load the page I get an internal server error!

The error number is: 1165965152-7090 (393970645).

When I comment out the form the page loads (but is almost blank), but as soon as I put it back in, even with nothing in between the open and close form tags I get the error again. The debug log does not show any errors, and shows that the code is doing everything necessary to set up the page.

Does anyone have any idea what I can do here?

Thanks

  • December 19, 2010
  • Like
  • 0

I just installed the Winter '09 Force.com IDE for Eclipse 3.3.2 on Windows XP.  I'm able to successfully create a Force.com project, connect to the service, and download the contents of a package.  But, when I try to access the Schema Browser, I get a dialog with the following error:

Unable to open Schema Browser

 

Reason: Invalid username, password, security token; or user locked out.

 I also get a series of errors in the Forec.com IDE Log Viewer:

  WARN [2009-02-24 10:56:06,069] (ProjectService.java:getForceProject:1595) - Unable to get credentials.  Credential map was not returned.
 WARN [2009-02-24 10:56:06,085] (BaseBuilder.java:checkSkipBuilder:77) - Skipping build - user credentials not found
 WARN [2009-02-24 10:56:16,428] (ProjectService.java:getForceProject:1595) - Unable to get credentials.  Credential map was not returned.
 WARN [2009-02-24 10:56:16,694] (BaseRetryAspect.java:isLoginExceptionRetryable:94) - Login evaluation deemed exception not retry-able:
 LoginFault: Invalid username, password, security token; or user locked out.
 WARN [2009-02-24 10:56:16,694] (BaseRetryAspect.java:isConnectionExceptionRetryable:130) - Connection evaluation deemed exception not retry-able:
 LoginFault: Invalid username, password, security token; or user locked out.
ERROR [2009-02-24 10:56:16,709] (SchemaBrowser.java:createPages:172) - Unable to open Schema Browser
com.salesforce.ide.core.remote.InvalidLoginException: Invalid username, password, security token; or user locked out.

Now, I know that the user isn't locked out because I just downloaded the package contents, and downloading again works successfully.  It's only the Schema Browser that presents a problem.

 

I also checked the Login History in the Salesforce org that I'm trying to connect to, and I see one successful login followed by a failed login.

x@x.x
2/24/2009 11:26:37 AM PST173.10.72.158Partner ProductInvalid PasswordJava (Salesforce.com)UnknownApex PluginN/ASOAP Partner15.0
x@x.x
2/24/2009 11:25:02 AM PST173.10.72.158Partner ProductSuccessJava (Salesforce.com)UnknownApex PluginN/A

 

 I am not using a Security Token since I am connecting via a trusted IP address.

 

Any idea what's going on or how to fix?

 

  • February 24, 2009
  • Like
  • 0
The Force.com Toolkit for Eclipse just got released with important updates. For those who are using the Toolkit, you'll want to pick up this update.  If you aren't using it yet, now it a great time to see why this is still the best tool going both for editing Apex code and s-controls, and for publishing finished Apex code into other Salesforce instances.

This latest Developer Preview release includes a large number of fixes and usability improvements, especially in the areas of package handling, project synchronization and deployment. See the release notes for details.

If you already have the August 16 release installed, you can pick up this update using the update facility built into Eclipse. You can find detailed instructions here.

Make sure you check out the release notes, FAQs, and installation guide on the toolkit’s main ADN page.

I'm trying to use new Input and InputField with type attribute. I need to use the date or datetime type as follow:

 

<apex:input value="{!birthdayDate}" type="date" styleClass="select-box"/>

 with corresponding controller:

 

public Date birthdayDate {
    get;
    set {
        System.debug('birthdayDate setter: ' + value);
        birthdayDate = value;
        currentAccount.PersonBirthdate = value;
    }
}

 

But when the user clears the field by clicking on the "x" button, the setter is not triggered and value cannot be reset.

I could use the inputField instead directly on PersonBithdate field, but I get an "Error: Invalid Date" when submitting the form.

FYI : I'm using API 29 (as requested by the Winter 14 release notes) for this files.

Thanks for your help.

 

  • November 01, 2013
  • Like
  • 0

I'm having trouble with the following code, for date fields only.  I assume it is because the date is not formatted correctly when passing the sobject json to the remote action.  I have tried a few different formats and there seems be a concensus that the date-time format is  ISO8601.  This is fine, but the middle option is formatted with ISO8601 and no dice.  

 

I am using the javascript date() to format the strings as well.

 

This does work for normal string/picklist fields, so that is why I am seeking help for the date field values.  Any help is greatly appreciated.

 

controller:

@RemoteAction
global static void setField(sObject obj) 
{
	upsert obj;
}

 

 

json:

var sObj = {id: "003Xxxxxxxxxxxxx", Date_of_Next_Meeting__c: "2013-08-26"};
or
var sObj = {id: "003Xxxxxxxxxxxxx", Date_of_Next_Meeting__c: "2014-06-23T07:00:00.000Z"};
or
var sObj = {id: "003Xxxxxxxxxxxxx", Date_of_Next_Meeting__c: "6/23/2014"}

 

 

js function;

Controller.setField(sObj, function(result, event){
		if (!event.status && event.type == "exception") {

			$j("[id$=':msgs']").text("Unable to save meeting preference:" + event.message).show();
		}
});

 

 

 JSON received in chrome js console:
action: "Controller"
data&colon; Array[1]
message: "Unexpected type for Controller.setField(SObject)"
method: "setField"
ref: false
result: null
statusCode: 400
tid: 15
type: "exception"
vfDbg: true
vfTx: true
where: ""
__proto__: h
 
and:
$VFRM.Util.error VFRemote.js:114
(anonymous function) VFRemote.js:130
a.Event.fire VFRemote.js:50
a.Observable.fireEvent VFRemote.js:45
VFExt3.Direct.VFExt3.extend.onProviderData VFRemote.js:84
a.Event.fire VFRemote.js:50
a.Observable.fireEvent VFRemote.js:45
VFExt3.direct.RemotingProvider.VFExt3.extend.onData VFRemote.js:92
VFExt3.extend.handleResponse VFRemote.js:73
a VFRemote.js:37
(anonymous function)
 

 

Hello, I develop en an Android application with the Salesforce Mobile SDK to store datas offline in using smartstore.

I saw the Mobile SDK Workbook but it's not said how store manually datas with smartstore.

Per example, I want when a user populate a form and submit it, store form's informations in the mobile with smartstore and I don't how do it.

In this time, I tried this :

function Track(){
    this.Id = null;
    this.Name = null;
    this.Price__c = null;
    this.Album__c = null;
    this.Album__r = null;
}

function Album(){
    this.Id = null;
    this.Name = null;
}

var track = new Track();
track.Id = $j('#idInput').val();
track.Name = $j('#nameInput').val();
track.Price__c = $j('#priceInput').val();
track.Album__c = $j('#albumIdInput').val();
track.Album__r = new Album();
track.Album__r.Id = $j('#albumIdInput').val();
track.Album__r.Name = "A name";

var myTable = [];
myTable.push(track);

addOfflineTracks(JSON.stringify(myTable), successAdd, errorAdd);

 

I get an error :

http://nsa33.casimages.com/img/2013/08/12/130812124002327909.png

 

 

I guess than I don't give the good datas to store with smartstore because when datas are loaded from a Salesforce controller, a list is given to store and I use a table.

How can I use a list en Javascript please?

 

Sorry if I use a bad language.

Hi All,

 

I am using some highchart.js file to plot a graph on visualforce page, if i use hard code value to graph in js code then it is working fine but, if i use VF remoting to bring data from apex controller to plot graph, VF remoating bringing data from apex controler but jquery not ploting graph at all.

I am pasting my VF page code. Please help me on this...

 

VF page code:

 

<apex:page controller="ChartController">

    <apex:includeScript value="{!URLFOR($Resource.jQuery)}"/>
    <apex:includeScript value="{!URLFOR($Resource.HighChartJS, '/js/highcharts.js')}"/>
    <apex:includeScript value="{!URLFOR($Resource.HighChartJS, '/js/modules/exporting.js')}"/>
    <script type="text/javascript">
            var accountNames = [];
            var optNums = [];
            var optProbs = [];
            $(function() {
                
                 //VF remoating start
                Visualforce.remoting.Manager.invokeAction(
                    '{!$RemoteAction.ChartController.getRemoteData}',
                    function(result, event){
                        if (event.status) {
                        
                            for(var i=0; i<result.length; i++)
                            {
                                accountNames.push(result[i].name);
                                optNums.push(result[i].data1);
                                optProbs.push(result[i].data2);
                            }
                            
                            alert(accountNames);
                        } 
                        else {
                            //document.getElementById("responseErrors").innerHTML = event.message;
                            alert(event.message);
                        }
                    }, 
                    {escape: true}
                );
            
                //VF remoating end
            });
            $.when.apply($, accountNames).done(function() {
                
                $('#container').highcharts({
                    chart: {
                        type: 'line'
                    },
                    title: {
                        text: 'Monthly Average Temperature'
                    },
                    subtitle: {
                        text: 'Source: WorldClimate.com'
                    },
                    xAxis: {
                        categories: accountNames
                        //categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
                    },
                    yAxis: {
                        title: {
                            text: 'Temperature (°C)'
                        }
                    },
                    tooltip: {
                        enabled: false,
                        formatter: function() {
                            return '<b>'+ this.series.name +'</b><br/>'+
                                this.x +': '+ this.y +'°C';
                        }
                    },
                    plotOptions: {
                        line: {
                            dataLabels: {
                                enabled: true
                            },
                            enableMouseTracking: false
                        }
                    },
                    series: [{
                        name: 'Tokyo',
                        //data&colon; optNums
                        data&colon; [7.0, 6.9, 9.5, 14.5, 18.4, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6]
                    }, {
                        name: 'London',
                        //data&colon; optProbs
                        data&colon; [3.9, 4.2, 5.7, 8.5, 11.9, 15.2, 17.0, 16.6, 14.2, 10.3, 6.6, 4.8] 
                    }]
                });
            });
<table width="100%">
    <tr>
 <td width="50%">
     <div id="container" style="width: 500px; height: 500px;"></div>
 </td>
    </tr>
</table>
</apex:page>

 

 

Hi,

My goal is to call a controller from a visualforce component using Javascript remoting and then to update the visualforce chart with the result.

 

The javascript remoting call works fine and I can see in the debug console that it receives the correct values as well. But how do I update the chart with this data?

 

Here's the javascript code. testCharts is my controller and getRemoteData is the RemoteAction method.

 

<script type="text/javascript">
function getOppChart() {
var year = '2013';

Visualforce.remoting.Manager.invokeAction(
'{!$RemoteAction.testCharts.getRemoteData}',
year,
function(result, event) {
if (event.status) {
	// Actions here, update VF chart?
} else if (event.type === 'exception') {
	document.getElementById("responseErrors").innerHTML = event.message;
} else {
	document.getElementById("responseErrors").innerHTML = event.message;
}
}, 
{escape: true}
);
}
</script>

The visualforce chart component. The data attribute is required. How do I pass the result from the javascript function here? I would like to make this dynamic so that when I select a value in a picklist on the page a new call is made and the chart is refreshed. But as a start I'd just like to know how to get the result there. If I was just using a controller I would just put the method name in the data attribute, i.e. data="{!oppData}".

 

<apex:chart height="300" width="600" data="???">
	<apex:axis type="Numeric" position="left" fields="data,data2" 
	title="Total Order value" grid="true"/>
	<apex:axis type="Category" position="bottom" fields="name" 
	title="Month of the Year">
	</apex:axis>
	<apex:lineSeries axis="left" fill="true" xField="name" yField="data2"
	markerType="cross" markerSize="4" markerFill="#FF0000"/>
</apex:chart>

 The reason I am not using the Apex controller methods directly is because of three reasons.

- I hope the user will find this more reponsive

- I want to be able to rerender the charts

- I just want to make it work!!!

 

Can't find anything on the boards or google. Anyone got ideas?? Much appreciated!

 

Thanks / Niklas

 

I have a page that generates a receipt number depending on the type of payment selected.

 

<apex:page  standardcontroller="Policy__c" extensions="policyControllerIntA,RecordPolicy"  ">

<apex:form id="Policy">

        <apex:pageBlock >       
<apex:pageBlockSection>
  
  <div class="wrap3_1"> 
 <div class="wrap3">  
        <apex:pageblockSection columns="3">
            <apex:actionRegion >
                <apex:dynamicComponent componentValue="{!Section_3}"/>    
            </apex:actionRegion>  
                <apex:dynamicComponent componentValue="{!AddFile}"/>        
        </apex:pageblockSection>       
    </div>   

<apex:define name="wrap">
     <div class="wrap5">  
      <apex:actionRegion >  
        <apex:pageblockSection title="Recibos" id="paystubs" >
            <apex:dynamicComponent componentValue="{!Section_5}"/>
        </apex:pageblockSection>  
     </apex:actionRegion>          
    </div>        
 </apex:define>

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

 extensions:

 

public with sharing class policyControllerIntA {
    public policyControllerIntA (ApexPages.StandardController con) { }

public Component.Apex.pageBlockSection  getSection_3(){


        Component.Apex.pageBlockSection s_three=new Component.Apex.pageBlockSection ();
        s_three.id='secthree';     
        s_three.collapsible=false;
        s_three.columns=4;

Component.Apex.SelectList fPayments= new Component.Apex.SelectList( multiselect = false, size = 1 );                  
       fPayments.expressions.value='{!fPayment}';
       fPayments.id='fPayments';
       fPayments.title='Forma de pago';
      
       
      Component.Apex.SelectOption so_Type_Payment= new Component.Apex.SelectOption();
      so_Type_Payment.itemLabel = 'Forma de Pago';
      so_Type_Payment.itemValue  = 'Forma de pago';
      
      
      Component.Apex.SelectOption so_Type_Payment1= new Component.Apex.SelectOption();
      so_Type_Payment1.itemLabel = 'Anual';
      so_Type_Payment1.itemValue  = 'Anual';      

      
      Component.Apex.SelectOption so_Type_Payment2= new Component.Apex.SelectOption();
      so_Type_Payment2.itemLabel = 'Semestral';
      so_Type_Payment2.itemValue = 'Semestral'; 
      
      Component.Apex.SelectOption so_Type_Payment3= new Component.Apex.SelectOption();
      so_Type_Payment3.itemLabel = 'Trimestral';
      so_Type_Payment3.itemValue = 'Trimestral';  
      
      Component.Apex.SelectOption so_Type_Payment4= new Component.Apex.SelectOption();
      so_Type_Payment4.itemLabel = 'Mensual';
      so_Type_Payment4.itemValue = 'Mensual';      
      
      
      Component.apex.actionSupport redPaystubs=new Component.apex.actionSupport();
      redPaystubs.event='onchange';
      Set<String> s1 = new Set<String>{'paystubs','fPayments'};
      redPaystubs.rerender=s1;
       
     
       
     if (fPayment=='Anual'||fPayment=='Semestral'||fPayment=='Trimestral'||fPaymentList=='Mensual'){       
       fPayments.childcomponents.add(so_Type_Payment1);       
       fPayments.childcomponents.add(so_Type_Payment2);       
       fPayments.childcomponents.add(so_Type_Payment3);
       fPayments.childcomponents.add(so_Type_Payment4);  
       fPayments.childcomponents.add(redPaystubs);  
    }else{
       fPayments.childcomponents.add(so_Type_Payment);
       fPayments.childcomponents.add(so_Type_Payment1);       
       fPayments.childcomponents.add(so_Type_Payment2);       
       fPayments.childcomponents.add(so_Type_Payment3);
       fPayments.childcomponents.add(so_Type_Payment4);  
       fPayments.childcomponents.add(redPaystubs);
    }

    s_three.childcomponents.add(niCompany);
    s_three.childcomponents.add(PDescription);
    s_three.childcomponents.add(fPayments);
  


return  s_three;

  }


public Component.Apex.pageBlockSection  getSection_5(){
integer asingNums;
integer Months;
        Component.Apex.pageBlockSection s_five=new Component.Apex.pageBlockSection ();
        s_five.id='sectfive';     
        s_five.collapsible=false;
        s_five.columns=12;
        
  
 
if (fPayment=='Anual'){Months=1;}
if (fPayment=='Semestral'){Months=2;}
if (fPayment=='Trimestral'){Months=4;}
if (fPayment=='Mensual'){Months=12;}

for(integer cont=0; cont<Months;cont++){
  Component.Apex.outputLabel nPaystub=new Component.Apex.outputLabel();
 
if(Months==1 || Months==2){
  nPaystub.value=cont + 1;
              if(cont==0){nPaystub.value=1;asingNums=1;}
                if(Months==2){ 
                              if(cont==0){nPaystub.value=1;asingNums=1;}
                              if(cont==1){nPaystub.value=2;asingNums=2;}
                                }

  }
else{
   if(Months==4 ){ 
              if(cont==0){nPaystub.value=1;asingNums=1;}
              if(cont==3){nPaystub.value=4;asingNums=4;}
              if(cont==1){nPaystub.value=3;asingNums=3;}
              if(cont==2){nPaystub.value=2;asingNums=2;}
            }
                else
                {
                   if(Months==12){
                                 if(cont==0){nPaystub.value=1;asingNums=1;}
                                 if(cont==11){nPaystub.value=12;asingNums=12;}
                                 if(cont==1){nPaystub.value=7;asingNums=7;}
                                 if(cont==2){nPaystub.value=2;asingNums=2;}
                                 if(cont==3){nPaystub.value=8;asingNums=8;}
                                 if(cont==4){nPaystub.value=3;asingNums=3;}
                                 if(cont==5){nPaystub.value=9;asingNums=9;}
                                 if(cont==6){nPaystub.value=4;asingNums=4;}
                                 if(cont==7){nPaystub.value=10;asingNums=10;}
                                 if(cont==8){nPaystub.value=5;asingNums=5;}
                                 if(cont==9){nPaystub.value=11;asingNums=11;}
                                 if(cont==10){nPaystub.value=6;asingNums=6;}
                               }                
                   } 
  }

 /*Component.Apex.inputTextarea....
 Component.Apex.inputTextarea....
 Component.Apex.inputTextarea....*/

return  s_five;

  } 

 and 

public with sharing class RecordPolicy{
    public RecordPolicy(ApexPages.StandardController con) { }

/************************* policy****************************/
 /*Public  String namecustomer{get; set;}
.
.
.*/
 Public  String fPayment{get; set;}
/*.
.  
 Public  Decimal pcommission{get; set;} */ 


 public integer  getnumPay(String fPayment){
  if (fPayment=='Forma de Pago'){return numberPay=1;}//----->
  if (fPayment=='Anual'||fPayment=='ANUAL'){return numberPay=1;}
  if (fPayment=='Semestral'||fPayment=='SEMESTRAL'){return numberPay=2;}
  if (fPayment=='Trimestral'||fPayment=='TRIMESTRAL'){return numberPay=4;}
  if (fPayment=='Mensual'||fPayment=='MENSUAL'){return numberPay=12;}
  return numberPay;
 }


Public PageReference save(){ 
/*
Policy__c p =new Policy__c (
*
*
fPayment__c=fPayment,
*
);

insert p;
parserId(p)
 
*
*/
createPaystub();
//
//
}


public void createPaystub() {
//
//

numPay=getnumPay(fPayment)
//
//

}

fPayment is a figure that interests me Policy__c saved, but it is still necessary for the rerender attribute on another extension. I need to access the contents of fPayment from policyControllerIntA.

Thanks

 

  • March 12, 2013
  • Like
  • 0

I am using a custom Site.

 

When a user forgets their password there is an option where I can reset the password then send it to their email address.  using this call which works fine:

 

Site.forgotPassword(username);

 


When the user tries to log in for the first time using their new password they are directed to the Site defined

Change Password VF  user interface/Page.  The force.com change password process is to populate the first apex:inputSecret field with the old password.  This old password is always wrong.

 

Site.changePassword(newPassword, verifyNewPassword, oldpassword);  

 

This call works as designed, it is telling me that the old password is wrong.  When I enter the correct password it works fine.  It is only when the ChangePassword VF page is displayed with the wrong old password is where I am having problems.

 

Is there a work around for getting the correct old password?  Can I make force.com give me the correct old password?

 

Thanks.

 

Tom

 

Hi I am new to visualforce but I am trying to write a controller to access and update a few custom fields. I added these fields to the User object. I have something like this.

 

public class CustomController {

 

    private User user;

 

    public CustomController(ApexPages.StandardController stdController) {

        this.user = (User)stdController.getRecord();

    }

 

 

     public void updateField() {

        String newCustomValue =Apexpages.currentPage().getParameters().get('newCustomValue');  

        user.CustomValue__c = newCustomValue;

        update user;

    }

}

 

My visual force page starts like:

<apex:page showHeader="false" standardController="User" extensions="CustomController">

 

<apex:form >
<apex:actionFunction name="updateField" action="{!updateField}" >
<apex:param id="newCustomValue" name="newCustomValue" value=""/>
</apex:actionFunction>
</apex:form>

 

 

But when I use this I get:

System.DmlException: Update failed. First exception on row 0; first error: MISSING_ARGUMENT, Id not specified in an update call: []

 

What am I missing?

 

I am trying to update my custom fields and have to available in my javascript rigth away.

Gauge Chart Scale is not showing Correctly

I need like 1 2 3 4 .... (scale =1)

But it is showing like 0,2,3,5,6,8....

 

===== VF Page ===============

<apex:page  Controller="GaugeChartController">
<apex:chart name="MyChart" height="300" width="450" animate="true" data="{!data}">
<apex:axis type="Gauge" position="gauge" title="Points" minimum="0" maximum="{!total }"/>
<apex:gaugeSeries dataField="size" donut="50" colorSet="#78c953,#ddd"/>
</apex:chart>
<script>
MyChart.on('beforeconfig', function(config) {
config.axes[0].margin=-10;
});
</script>
</apex:page>

 

======= Controller ==============

public class GaugeChartController {
public integer total {get;set;}

public List<gaugeData> getData() {
total =15;
List<gaugeData> data = new List<gaugeData>();
data.add(new gaugeData(10 + ' Opptys', 5));
system.debug('test $$$$ '+data);
return data;
}

public class gaugeData {
public String name { get; set; }
public Integer size { get; set; }

public gaugeData(String name, Integer data) {
this.name = name;
this.size = data;
}
}
}

 

Please correct me any thing wrong here. 

http://screencast.com/t/iI11VSFyCj4

Iam trying to use the Ext Js in visual force page.I have downloaded the ExtJs SDK 4.1.1a file.and iam uploading the file into static resources.As there is a size limit of 5 mb for each file in static resource i deleted some of  the files in Ext JS SDK 4.1.1a. I have kept some of the files like resources and all the js files into a folder extjs.zip and uploaded into static resource.But it is not working....

My code is as follows

<apex:page >
<link rel="Stylesheet" type="text/css" href="{!$Resource.ExtJS}/resources/css/ext-all.css" />
<script type="text/javascript" src="{!$Resource.ExtJS}/ext-all.js"></script>
<script type="text/javascript">

Ext.onReady(function(){

Ext.Msg.show({
title: 'Milton',
msg: 'Have you seen my stapler?',
buttons: {
yes: true,
no: true,
cancel: true
}
});

});

</script>
</apex:page>

please help me regarding the issue..

I am facing an issue with the Chatter:feed tag when I used it in HTML5 VF page. It doesn't allow me to add the link. Any thoughts? It hangs sometimes when i switch between link, post, file or etc...Anybody is facing the same issue...let me know your thoughts. appreciate your help!

We have a VisualForce page that needs to change it's appearance based on which parent page contains our page.

 

For example, we have a list of 10 phrases.  4 of them should appear on the Account page, 9 should appear on the Contact page, etc...

 

What we'd like to do is to have a filter string configured for each phrase, then compare the filter string against the name of the current page to determine which ones to display.

 

As near as I can tell, $CurrentPage returns the VisualForce page (not the page that contains the VisualForce view), so that doesn't seem like what we want.  Also, I imagine that this sort of filtering is best done in a controller, so we need to somehow get the current containing page name from the controller.

 

Any ideas?

In visual force charting how can we ensure that zero axis is always displayed and  the step values are rounded off to hundred. For certain reasons the value zero does not appear on the chart and thus making the graph hard to read, As you can see in the image the axis the values are not equally distributed on the positive and negative axis.

 

 

 

 

Thanks in advance

Regards

S.Aj

  • February 10, 2013
  • Like
  • 0

All -

 

So I think I just need direction on a place to start. I have been using google Charts and Visualizations to display complex scatter charts and line graphs. They way I have accomplished this is through the use of long text fields that contain up to 4K plot point in the X and 4000 in the Y field. This has allowed me to do some really great displays.

 

Now my user is asking me if I can layer my line graphs. Each line graph has it's own X and Y. To be clear, they rarely share a location on a graph (ie...X1 != X2 or Y1 != Y2). I have read and viewed many layered sales graphs that use the same year or month, but I do not have that commonality in mine. 

 

Is there a way to do a layered line graph with up to 6 lines where the only constant is my Max and Min? Can someone point me in the right direction? I would like to use VF Charts if at all possible.

 

Thank you in advance for any assistance you can provide.

 

JP

I have a commandButton to reprocess a set of filters and on clicking Go, the page redraws the charts and tables. When the page first loads I process and display the charts on the page with no problem. When I click Go, all the charts and tables display except the bar chart.

 

I get this error in my browser console:

Visualforce Chart: Error loading configuration for chart 'jid0jid29jid55jid56jid57jid64': Did not find required field 'ftRev,tgtRev' in data for chart 'jid0jid29jid55jid56jid57jid64'. Make sure field was queried and/or provided and has a value.

 

 

Here are extracts from the page code:

...

<apex:commandButton action="{!updatePage}" value="Go" id="theButtonCM"/>

...

<apex:outputPanel id="barchart">
<apex:pageBlock >
<apex:pageBlockTable value="{!perfSummList}" var="d" align="center">
<apex:column value="{!d.ftRev}" headerValue="FT"/>
<apex:column value="{!d.tgtRev}" headerValue="tgt"/>
<apex:column value="{!d.monthYYYYMM}" headerValue="mth"/>
<apex:column value="{!d.monthStr}" headerValue="mth"/>
</apex:pageBlockTable>
<b>ft revenue vs target</b><br/>
<apex:chart data="{!perfSummList}" height="300" width="500">
<apex:legend position="bottom" spacing="10" padding="2" font="10px Helvetica"/>
<apex:axis type="Category" position="bottom" fields="monthStr">
<apex:chartLabel />
</apex:axis>
<apex:axis type="Numeric" position="left" fields="tgtRev,ftRev" minimum="0" >
<apex:chartLabel />
</apex:axis>
<apex:barSeries axis="left" orientation="vertical" xField="monthStr" yField="ftRev,tgtRev" title="F+T,Target">
<apex:chartLabel />
</apex:barSeries>
</apex:chart>
</apex:pageBlock>
</apex:outputPanel>

 

The data in the table is from the same list and shows up just fine - the fields reported have values as surely the table would show if they did not. Something is going on under the hood for the charts and I can find out the issue here.

 

Any ideas?

 

 

The salesforce.com docs states remoting methods can take the following values as arugments, "primitives, collections, typed and generic sObjects, and user-defined Apex classes...". There appears to be an issue with generic sObject. Take a look at the following Visualforce page and the related remoting method.

 

<apex:page showHeader="true" sidebar="true" controller="RemotingSObject">
	<input value="Click Me" onclick="doRemote();" type="button"/>

	<script type="text/javascript">
		
		function doRemote(){
			var obj = {
				sobjectType: 'Account',
				Name: 'My new account'
			};

			//You can see there is a value of sbojectType set
			console.log(obj);

			Visualforce.remoting.Manager.invokeAction('{!$RemoteAction.RemotingSObject.receiveSObject}', obj, function(result, event){
		        console.log(event);
		        console.log(result);
			});
		}

	</script>
</apex:page>

 The Class:

public with sharing class RemotingSObject {
	@RemoteAction
	public static void receiveSObject(SObject obj) {
		system.debug(obj); 
	}
}

 If you look in the browsers JavaScript console you will see this error message:

Visualforce Remoting Exception: Unable to determine SObject type: SObject. Please provide an 'id' or 'sobjectType' value.

 

Makes no sense as an sobjectType value is being supplied. Oddly enough if you provide an id value it works...but if you are trying to insert a new sObject you do not yet have an id value to use.

 

Any ideas on how to make this work? Bug?

 

Thanks,

Jason

 

  • February 05, 2013
  • Like
  • 1

Hello,

 

  I am using sencha and salesforce to build a mobile SDK. My app was working just fine for my part where I was able to query object from salesforce as well as insert. But after adding my co-worker's code into my project i get an error in the javascript console in my browser and I can longer naviaget to my page but only to his, but then when I go to his pages I can;t query any object. If I add my code to my co-worker it works just fine. Am i forgetting to configure something? The error is below.

 

  1. Visualforce Remoting Exception: No serializer found for class core.filemanager.FileBlobValue
  2. VFRemote.js:114
    1. $VFRM.Util.errorVFRemote.js:114
    2. (anonymous function)VFRemote.js:129
    3. a.Event.fireVFRemote.js:48
    4. a.Observable.fireEventVFRemote.js:43
    5. _Visualforce.Direct._Visualforce.extend.onProviderDataVFRemote.js:83
    6. a.Event.fireVFRemote.js:48
    7. a.Observable.fireEventVFRemote.js:43
    8. _Visualforce.direct.RemotingProvider._Visualforce.extend.onDataVFRemote.js:91
    9. _Visualforce.extend.handleResponseVFRemote.js:72
    10. (anonymous function)