• ☯ BonY ☯
  • NEWBIE
  • 210 Points
  • Member since 2015
  • Developer


  • Chatter
    Feed
  • 6
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 0
    Questions
  • 19
    Replies
Hello,

I was working on a custom datepicker in a visualforce that can display date in User locale. While going through some articles on the best way of implementing a datepicker with localization support I came across the JQuery Datepicker. I wanted to ensure that the datepicker displays date always in user locale. But while implementing I am unable to set the dateformat accordingly.

Here is my VF page code..
<apex:page controller="TestController" docType="html-5.0" sidebar="false">
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css"/>
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
<script type="text/javascript"> 
var userlang = window.navigator.language;
console.log(userlang);
$(function(){
    $("#datepicker").datepicker({
        formatDate:'dd-mm-yyyy',
        changeMonth:true,
        changeYear:true
    });
});

</script>
<apex:form >
<apex:pageBlock id="pgblk">
<input value="{!dateVariable}" type="text" id="datepicker"/>
</apex:pageBlock>
</apex:form>
</apex:page>
The controller doesn't have anything else than the getter & setter methods for the variable dateVariable. As you can see, I am hardcoding the format in the above code to 'dd-mm-yyyy'. But still during execution, I see the format as 'mm/dd/yyyy'. 

Can anyone help on this?

Thanks in advance!
Pathikrit
 
Is there any alternative for using apextab with jquey.I created a simple page with jquery and apextab and the tab was not working,
I tried to use jQuery.noConflict();  and that also did not work.Please find the code below
<!-- For this example to render properly, you must associate the Visualforce page 
with a valid account record in the URL. 
For example, if 001D000000IRt53 is the account ID, the resulting URL should be: 
https://Salesforce_instance/apex/myPage?id=001D000000IRt53
See the Visualforce Developer's Guide Quick Start Tutorial for more information. -->
                    
<!-- This example shows how to use the tabClass and inactiveTabClass attributes to
change the default styling of the tab bar. Note that in the style definitions,
'background-image:none' is required to override the default image with the
specified color. You can also provide your own image with .css styles. -->
            
<apex:page standardController="Account" showHeader="true">
      <apex:form >
        <!-- Define Tab panel .css styles -->
    <style>
    .activeTab {background-color: #236FBD; color:white; background-image:none}
    .inactiveTab { background-color: lightgrey; color:black; background-image:none}
    </style>
            
   <!--     <script type="text/javascript" language="javascript">
    if(jQuery) {
        jQuery.noConflict();
        alert('hi');
    }
</script> 

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script>
<!--<script>
$(document).ready(function(){
    $("p").click(function(){
        alert("The paragraph was clicked.");
    });
});
</script>

        <p>Click on this paragraph.</p>
-->

            
    <!-- Create Tab panel -->
    <apex:tabPanel switchType="client"  id="AccountTabPanel"
        tabClass="activeTab" inactiveTabClass="inactiveTab">
        <apex:tab label="One" name="name1" id="tabOne">content for tab one
        
<apex:page standardController="Account">

        <apex:pageBlock title="My Content" mode="edit">
            <apex:pageBlockButtons >
                <apex:commandButton action="{!save}" value="Save"/>
            </apex:pageBlockButtons>
            <apex:pageBlockSection title="My Content Section" columns="2">
                <apex:inputField value="{!account.name}"/>
                <apex:inputField value="{!account.site}"/>
            </apex:pageBlockSection>
        </apex:pageBlock>
   
</apex:page>
        
        
        </apex:tab>
        <apex:tab label="Two" name="name2" id="tabTwo">
   
        <apex:pageBlock title="My Content" mode="edit">
            <apex:pageBlockButtons >
                <apex:commandButton action="{!save}" value="Save"/>
            </apex:pageBlockButtons>
            <apex:pageBlockSection title="My Content Section" columns="2">
                <apex:inputField value="{!account.type}"/>
                <apex:inputField value="{!account.accountNumber}"/>
            </apex:pageBlockSection>
        </apex:pageBlock>

        content for tab two</apex:tab>
    </apex:tabPanel>
        </apex:form>
</apex:page>

 
Hello,

I have a Date field (custom__c) on Opportunity, I want to make it mandatory if the Stage of opportunity is "stage 3", there are 5 stages in total

Thank you
  • October 05, 2015
  • Like
  • 0
Hi All,

Please bear with me since I am a complete newbie in Apex. I have a requirement that whatever number is entered on a custom number field, it will add to hours of Date/Time Field.

Ex. Date/Time field = 07/10/2015 1:37 AM
      Custom_Number__c = 5
      Answer should be = 07/10/2015 6:37 AM

I would be glad if someone can share their codes. Thank you.
Amount  :
Discount :

Net Price:

I need i will give Amount value and Discount values But on UI page Directly calculated that two column fields ,and display the net price total value.

please tel me how to create  and display values. 

Hi,

I am trying to create a formula field for the below requirement for which i need help on it


I have to convert milli seconds value given to the normal time value using a formula field


I tried the below formula its working fine for minutes and seconds , but not sure how to add hours to it

MY FORMULA :
IF((MOD((Duration_Number__c )/60,1)*60) > 10,
TEXT(FLOOR( (Duration_Number__c )/60)) + ":" + TEXT( FLOOR(MOD((Duration_Number__c )/60,1)*60) ),
TEXT(FLOOR( (Duration_Number__c )/60)) + ":0" + TEXT( FLOOR(MOD((Duration_Number__c )/60,1)*60) )
)

I tried to add hrs but getting incorrect number of parameters in if expected 3 recieved 4

Help me how to add hrs in my formula

Thanks in Advance
  • September 18, 2015
  • Like
  • 1
I'm using VisualForce dataTables . How can I create a header row that spans multiple columns like in the example below ? 

DataTable Header Example
Hello Guru's,

I have a weird problem, I don't have any specific script in VF however, if i use  the below code and try to print i have a 'blue' border line coming along.My need is to get over it.
 
<apex:page sidebar="false" showHeader="false" >
 
  <h1>Congratulations</h1>
  This is your new Page

</apex:page>
I also tried debugging using the chome developer mode, i could see that following class are setting border in 'blue; colors.I tried to over-ride the class in my <Style> tag but did not work. Please help! 

Chrome Developer mode

Thanks,
Raja Bipin Chandra
Hi All,

  Need help!!

 I am trying to access VisualForce Page elements(Checkbox) from Case detail Page using Custom button javascript. But document.getElementsByClassName('chkSelected')  does not get recognized. Any help is highly appreciated.. Thanks!! 
Hello,

I was working on a custom datepicker in a visualforce that can display date in User locale. While going through some articles on the best way of implementing a datepicker with localization support I came across the JQuery Datepicker. I wanted to ensure that the datepicker displays date always in user locale. But while implementing I am unable to set the dateformat accordingly.

Here is my VF page code..
<apex:page controller="TestController" docType="html-5.0" sidebar="false">
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css"/>
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
<script type="text/javascript"> 
var userlang = window.navigator.language;
console.log(userlang);
$(function(){
    $("#datepicker").datepicker({
        formatDate:'dd-mm-yyyy',
        changeMonth:true,
        changeYear:true
    });
});

</script>
<apex:form >
<apex:pageBlock id="pgblk">
<input value="{!dateVariable}" type="text" id="datepicker"/>
</apex:pageBlock>
</apex:form>
</apex:page>
The controller doesn't have anything else than the getter & setter methods for the variable dateVariable. As you can see, I am hardcoding the format in the above code to 'dd-mm-yyyy'. But still during execution, I see the format as 'mm/dd/yyyy'. 

Can anyone help on this?

Thanks in advance!
Pathikrit
 
Is there any alternative for using apextab with jquey.I created a simple page with jquery and apextab and the tab was not working,
I tried to use jQuery.noConflict();  and that also did not work.Please find the code below
<!-- For this example to render properly, you must associate the Visualforce page 
with a valid account record in the URL. 
For example, if 001D000000IRt53 is the account ID, the resulting URL should be: 
https://Salesforce_instance/apex/myPage?id=001D000000IRt53
See the Visualforce Developer's Guide Quick Start Tutorial for more information. -->
                    
<!-- This example shows how to use the tabClass and inactiveTabClass attributes to
change the default styling of the tab bar. Note that in the style definitions,
'background-image:none' is required to override the default image with the
specified color. You can also provide your own image with .css styles. -->
            
<apex:page standardController="Account" showHeader="true">
      <apex:form >
        <!-- Define Tab panel .css styles -->
    <style>
    .activeTab {background-color: #236FBD; color:white; background-image:none}
    .inactiveTab { background-color: lightgrey; color:black; background-image:none}
    </style>
            
   <!--     <script type="text/javascript" language="javascript">
    if(jQuery) {
        jQuery.noConflict();
        alert('hi');
    }
</script> 

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script>
<!--<script>
$(document).ready(function(){
    $("p").click(function(){
        alert("The paragraph was clicked.");
    });
});
</script>

        <p>Click on this paragraph.</p>
-->

            
    <!-- Create Tab panel -->
    <apex:tabPanel switchType="client"  id="AccountTabPanel"
        tabClass="activeTab" inactiveTabClass="inactiveTab">
        <apex:tab label="One" name="name1" id="tabOne">content for tab one
        
<apex:page standardController="Account">

        <apex:pageBlock title="My Content" mode="edit">
            <apex:pageBlockButtons >
                <apex:commandButton action="{!save}" value="Save"/>
            </apex:pageBlockButtons>
            <apex:pageBlockSection title="My Content Section" columns="2">
                <apex:inputField value="{!account.name}"/>
                <apex:inputField value="{!account.site}"/>
            </apex:pageBlockSection>
        </apex:pageBlock>
   
</apex:page>
        
        
        </apex:tab>
        <apex:tab label="Two" name="name2" id="tabTwo">
   
        <apex:pageBlock title="My Content" mode="edit">
            <apex:pageBlockButtons >
                <apex:commandButton action="{!save}" value="Save"/>
            </apex:pageBlockButtons>
            <apex:pageBlockSection title="My Content Section" columns="2">
                <apex:inputField value="{!account.type}"/>
                <apex:inputField value="{!account.accountNumber}"/>
            </apex:pageBlockSection>
        </apex:pageBlock>

        content for tab two</apex:tab>
    </apex:tabPanel>
        </apex:form>
</apex:page>

 
Original question:
hi friends
 I am created onee vf page in that i am created i am script 
like
<script>
 function show(){
  alert('...');
}
show i am called in Command Button

now my requirement is when pop up coms then i hav to create
alert box with this
do you want to resend email
     yes   no
if he clickss yes email should go
if he clicks no that reord sholud be updated
the vf page is for updation only
 in the vf i am taken two extensions
<apex:commandbutton action="{!Addrecord}" value="update"/>

no how could i write for send emails
in the controller sendemail() method is there 
Guys,

I am trying to pass Javascript Variable value to apex method, it always returns null in apex method when i try to see the value using system.debug,  I did try the following solution from net but still not working, any thoughts?

thanks,

--------------------------------------------------------------------------------------------------------------------------------------------

public class myController {
  public string myProperty {get; set;}
 

  public void myTest() {
    System.debug('VARIABLE MYPROPERTY------' + myProperty);

  }

}
 
And on the visualforce you can pass javascript variable as -
 
Using InputHidden
<apex:inputHidden value="{!myProperty}" id="inptHdn"/>
 
<script>
  function passVariable() {
    String str = 'my test value';
    document.getElementById('<ID OF INPUT HIDDEN>').value = str;
  }
</script>
 
Using action function
 
<apex:actionFunction name="myFun" action="{!myTest}">
  <apex:param name="a" value="" assignTo="{!myProperty}"/>
</apex:actionFunction>
 
and you can call this action function from javascript method as
 
<script>
  function passVariable() {
    String str = 'my test value';
    myFun(str);
  }
</script>

-----------------------------------------------------------------------------------
Dear Folks,

Can someone please help to frame the syntax?

I have 2 Picklists
Pick list 1 (values: Quarterly, Annually)
Pick list 2 (values: Quarterly, Annually)

If Pick list 1 value is Quarterly then Set Pick list 2 value to Quarterly
If Pick list 1 value is Annually then Set Pick list 2 value to Annually

Thanks,
Kumar
 
trigger ClosedOpportunityTrigger on Opportunity (after insert,after update) {
List<task> carry=New List<task>();

  for(opportunity opp:trigger.new){
   if(opp.stagename=='closed own'){
    task t=new task(whatid=opp.id);
    carry.add(t); 
    }
   }
     insert carry;

 }

 The trigger will add a task to any opportunity inserted or updated with the stage of 'Closed Won'. The task's subject must be 'Follow Up Test Task'.The Apex trigger must be called 'ClosedOpportunityTrigger'
With 'ClosedOpportunityTrigger' active, if an opportunity is inserted or updated with a stage of 'Closed Won', it will have a task created with the subject 'Follow Up Test Task'.
To associate the task with the opportunity, fill the 'WhatId' field with the opportunity ID.
This challenge specifically tests 200 records in one operation.

I tried with the above code, task is not created.
I need to map a custom text area field from the lead object to the opportunity (currently mapped) as well as the contact object.  All the same field type and name.

 
Hello,

I have a Date field (custom__c) on Opportunity, I want to make it mandatory if the Stage of opportunity is "stage 3", there are 5 stages in total

Thank you
  • October 05, 2015
  • Like
  • 0
Hi All,

Please bear with me since I am a complete newbie in Apex. I have a requirement that whatever number is entered on a custom number field, it will add to hours of Date/Time Field.

Ex. Date/Time field = 07/10/2015 1:37 AM
      Custom_Number__c = 5
      Answer should be = 07/10/2015 6:37 AM

I would be glad if someone can share their codes. Thank you.
Amount  :
Discount :

Net Price:

I need i will give Amount value and Discount values But on UI page Directly calculated that two column fields ,and display the net price total value.

please tel me how to create  and display values. 
Hi all, 

I have a VF-Page for NewCollege, through this i am going to insert new college to some other database using API(not into custom or standard object), now my question is how can i give defalut value for a text box(if the text box is in some custom or standard object we can give while the field creation itself, but this field is from API,). so how can i give default value while declaring in visualforce page. 

and also after text box i want to show some text as shown in bellow screen. give me suggestion to achive it.

User-added image

Thanks in advance.
 
  • September 22, 2015
  • Like
  • 0
Hi, 
I have created a trigger and I now testing it from a test class. 
Something is going wrong and I would like to figure out what. 
I am using the salesforce developer console.
I have put system.debug messages in strategic places in the test class and in the trigger itself.
non of them of showing on the logs tab.
I am sure that there is something simple that I am missing. 
Please advice, 
Thank, 
Aidel

Hi,

I am trying to create a formula field for the below requirement for which i need help on it


I have to convert milli seconds value given to the normal time value using a formula field


I tried the below formula its working fine for minutes and seconds , but not sure how to add hours to it

MY FORMULA :
IF((MOD((Duration_Number__c )/60,1)*60) > 10,
TEXT(FLOOR( (Duration_Number__c )/60)) + ":" + TEXT( FLOOR(MOD((Duration_Number__c )/60,1)*60) ),
TEXT(FLOOR( (Duration_Number__c )/60)) + ":0" + TEXT( FLOOR(MOD((Duration_Number__c )/60,1)*60) )
)

I tried to add hrs but getting incorrect number of parameters in if expected 3 recieved 4

Help me how to add hrs in my formula

Thanks in Advance
  • September 18, 2015
  • Like
  • 1
Hi,
  
   We have two 3 roles ( Finance Approver , GHC Approver  , Program Administrator ) This can be assinged to only one user it cannot be assigned to multiple users we want to add a validation rule if this role is already assigned need to display a message in user screen please suggest me how to write this validation rule 

Thanks
Sudhir