• DannyK89
  • NEWBIE
  • 445 Points
  • Member since 2011

  • Chatter
    Feed
  • 17
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 115
    Questions
  • 128
    Replies

Hi everyone,

 

So I am getting the hand of apex methods being called remote from javascript.

Of course I am having some issues. I have put a temparary method in my apex class that I want to be called from some javascript in the visual force page.

However it seems that I have a bug somewhere because the javascript does not run. 

I have been looking at this code for i'm guessing a couple of hours and can't see what is wrong. 

Maybe someone on here can give me a hand.

 

Visualforce Javascript / code:

 

<apex:page controller="AMManagementController">
<script>
        function switchMenu(obj,obj1,obj2) 
        {
            var el = document.getElementById(obj);                                       
            if ( el.style.display != 'none' ) {
            el.style.display = 'none';
            }
            else {
            el.style.display = '';
            }
            var e2 = document.getElementById(obj1);                                       
            if ( e2.style.display != 'none' ) {
            e2.style.display = 'none';
            }
            else {
            e2.style.display = '';
            }
             var e3 = document.getElementById(obj2);                                       
            if ( e2.style.display != 'none' ) {
            e3.style.display = 'none';
            }
            else {
            e3.style.display = '';
            }

        }
        
        function CheckUpdate(){
            AMManagementController.UpdateCheck('Update',function(result, event){
                if(result == false)
                    alert('Are you sure you want to do this?');
            },{escape: true});
        }
</script>
<apex:form >
<apex:pageBlock tabStyle="Account" title="Requirement Management">
    <apex:pageBlockButtons >
        <apex:commandButton value="Back" onclick="CheckUpdate();"/>

 

Apex method trying to call:

 

global class AMManagementController {

public AMManagementController(){}

@RemoteAction
    global static boolean UpdateCheck(String test){
        return true;
    }

}

 

Hi Everyone,

 

I am having a problem with some code I am trying to write. I want to create a calculator inside salesforce. When I try to add a output text tag with a variable in it I keep getting the unknown property error.

The variable is defined in my custom apex controller. IT has a getter and setter methods and is set to public. I don't understand what the problem is?

Can someone help me out. 

 

Below is my code that I have created so far:

 

Visualforce page:

<apex:page controller="DirectHireCalcController">
<apex:form >
<apex:page >
    <apex:pageBlock title="Direct Hire Fee Calculator">
        <apex:pageBlockSection columns="1">
            <apex:pageBlockSectionItem helpText="This value is automatically calculated. Do not enter a value.">
                <apex:outputLabel value="Direct Hire Fee"/>
                <apex:outputPanel id="DirectHireFee">
                    <input type="text" value="" readonly="readonly" style="color:black; font-weight:bold; border:1px solid #AEAEAE; background-color:white;"/>
                    <!--<apex:inputText label="Gross Margin Pct" value="{!GrossPctString}" disabled="true" style="color:black; font-weight:bold; border:1px solid #AEAEAE; background-color:white;"/>-->
                </apex:outputPanel>
            </apex:pageBlockSectionItem>
            <apex:outputText >
                {!DHPercent}
            </apex:outputText>
        </apex:pageBlockSection>
    </apex:pageBlock>
</apex:page>
</apex:form>
</apex:page>

Controller:

public class DirectHireCalcController {
    public String DHFee {get; set;}
    public String DHPercent {get; set;}
    public DirectHireCalcController(){}
}

 

 

Thanks,

I am trying to put an inputText field that is disabled on a visualforce page. I have put some style attributes on the field that make it look like a regulart inputText field on google chrome and fireFox. I wanted the fields to have bolded Text and have a white background. The style attributes worked on chrome and firefox but not IE. When I Enable the inputText field the text is bolded. I would like to have it where the text is bolded and the inputText field is disabled. Can someone please help me out.

 

Thanks,

 

<apex:inputText label="Gross Margin" disabled="true" value="{!GrossString}" style="color:black; font-weight:bold; border:1px solid #AEAEAE; background-color:white;"/>

 

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 everyone,

 

I would like to know if there is a way to check if a user is using a mobile device or computer when accessing a visualforce page.

I would like mobile users to see certain fields and comptuer users to see certain fields.

Ok so I have been working on a custom public site. Everything on the site is working fine until I try to open a popup window from the visuaforce page. When I do that on certain browsers Like IE i get a warning message.

 

The message reads:

 

To display the webpage again, the web browser needs to resend the information you've previously submitted. If you were making a purchase, you should click Cancel to avoid a duplicate transaction. Otherwise, click Retry to display the webpage again.

 

Is there any way to stop this warning from appearing when I have a popup window open?

I am creating an email template. I would like the email template to show the first name of a contact attached to a custom object I build. I have tried this: {!Object__c.Contact__c.FirstName} but it shows up as a blank on the email. Is it possible to show just the first name of the contact related to the custom object. Thank. 

I would like to change the color of one of my pageblocksections. Below is just a sample if what I would like to do. I would like to change the color of the first pageblocksection. I would like to know if this is possible or not. 

 

Thanks. 

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

 

I am having some issues that I need some help with.

 

I have a page with a field set on it that is part of a repeat tag. I want the look up field to auto populate with the users first and last name. I have found a way to populate the look up but it can't be part of the repeat tag. I am not sure what the problem is. 

 

Visualforce code:

 

<apex:page standardController="Account" showHeader="false">
 <script type="text/javascript" charset="utf-8" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>  
 <script type="text/javascript" charset="utf-8" src="http://code.jquery.com/mobile/1.0b3/jquery.mobile-1.0b3.min.js"></script>
  <apex:form id="AccountForm">
      <apex:pageBlock id="AccountBlock">
      <apex:pageBlockSection id="AccountSection">
          <apex:inputField id="Contact" value="{!Account.Contact_Test__c}" rendered="true"/>
          <apex:repeat id="FieldList" value="{!$ObjectType.Account.FieldSets.test}" var="set">
              <apex:inputField id="ContactLookup" value="{!Account[set]}" rendered="{!CONTAINS(LOWER(set), LOWER('Contact_Test__c'))}"/>
              <apex:inputField value="{!Account[set]}" rendered="{!NOT(CONTAINS(LOWER(set), LOWER('Contact_Test__c')))}"/>
          </apex:repeat>
      </apex:pageBlockSection>
      </apex:pageBlock>
  </apex:form>
<script type="text/javascript">
  try
  {
    var form = document.getElementsByTagName("FORM");
    var formid= '#' + form[0].id.replace(/:/g, "\\:");
    $(formid+"\\:AccountBlock\\:AccountSection\\:Contact").val('{!$User.FirstName} {!$User.LastName}');
  }
  catch(err)
  {
    alert(err);
  }
</script>
</apex:page>

 

I am working with a custom object that has a look up field. I was wondering if it is possible to plug in a partail name into the look up field and then search using the look up field. I know I can type the name into the look up and that works but I would like to auto fill the lookup field with a partail name. Im not sure if this is possible and would like some guidence. Thanks.

I have implemented the recaptcha in my site. However I am running into an issue. The issue is not that major and I can live with it but I would like some help fixing it. My issue is that when I come to the page with the recaptcha on it the focus of the page is the response field for the recaptcha. I would like it to be the first field on the page. I followed the help on this article:

 

http://wiki.developerforce.com/page/Adding_CAPTCHA_to_Force.com_Sites

 

Is there any way to make the focus go off of the recaptcha and onto the first field?

Is there a way to display how many characters the user has left like it does on a detail page. The issue I am running into is that when I try to save the data I put into the field the page tells me that I am over the character count. However I don't know by how much. So I am forced to guess. Thanks.