I'm using remote action to call apex function, and the issue is the parameter that passed might contain several white space, But I can see in the logs that several white spaces are being removed, and only 1 is left. Any idea how to avoid this issue? I thought to replace the white spaces before the invoke method with some characters and then in apex restore it, but perhaps there is better solution.

As example- I tried to enter value: "1 2 3" but in the remote function it received as: "1 2 3"

<apex:page controller="MyController">



            <apex:pageBlockButtons >

                <apex:commandButton value="Call Remote" oncomplete="callRemoteJS(); return false;"/>

            <apex:pageBlockSection columns="1" id="pbSectionId">

                <textarea id="inputAreaid" />



function callRemoteJS(){
        var inputText = document.getElementById('inputAreaid').value;

        console.log('inputText :' +inputText );

            function(result, event){
                    //handle response


global class MyController{

    public MyController(){

    public static String remoteFunction(String testParam){

        System.debug('testParam:' + testParam);

        return 'ok';

enter image description here


At first I thought it might be something to do with escape parameter in JavaScript remoting.

But issue here is the logs in developer console trims the extra spaces, if you double click on the line or view it in debug logs, you would see correct value with spaces.

enter image description here

  • Thanks. You're right. Actually I see this also in the object field... As in my remote I'm saving the data to object fields, and when view it in the layout it is shown without spaces, but when open the record in edit mode, it does show the spaces. – Liron C Jan 13 '18 at 18:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.