• krishna casukhela 7
  • NEWBIE
  • 204 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 3
    Likes Received
  • 0
    Likes Given
  • 61
    Questions
  • 59
    Replies
I have a simple page as follows. The user enters first name and selects country name from picklist and hits the save button, so values are saved
to backend.

How to convert this page so it can be used for multiple languages?

a user in china should see the page as per chinese lanuage. How to achieve this?

How to use custom settings OR custom labels, translation workbench or do I have to code?

can any one pls explian in detail with code ?

Thanks
krishna
 
I am having a piece of code which fetches countryname along with its code from custom setting
and populates the country name into the visual force page.

In custom setting, type=LIST , anme is Countries__c and it has a field called CountryCode__c.

if the user selects Australia from vf page and click SAVE button then 'CA' is stored in the backend and so on.
The values in custom settings are not very huge.

Now i need to have another picklsit in vf page , which will display the state name based on the country selected.

I want to store the states names also in custom settings(state names are not many just a few).

Here is what I have achieved so far.
 
public List<SelectOption> CountryCodeList=new List<SelectOption>();

public String selectedCountryCode {get; set;}

 public  List<SelectOption> getCountryCodes() 
   {
        if(countryCodeList.isEmpty())
        {
           countryCodeList=new List<SelectOption>();
           List<Countries__c> allCountries = new List<Countries__c>();

           allCountries = [SELECT  Name,CountryCode__c
                                  FROM    Countries__c];

             
          allCountries.sort();
          
List<Countries__c> cList=new List<Countries__c>([select CountryCode__c 
                                                        from Countries__c 
                                                        where CountryCode__c=:selectedCountryCode]);
          
          if (cList.size() > 0)
          {
          
            for(Countries__c country : allCountries )
            {
              
                countryCodeList.add( new SelectOption( country.CountryCode__c, country.Name ) );
            }
          }
          else
          {
             countryCodeList.add(new SelectOption('--Select--', '--Select--'));

          }
       } 
     
        return countryCodeList;
   }
   
   

<apex:selectOption itemValue=" " itemLabel="--Select--"></apex:selectOption>
<apex:selectOptions value="{!countryCodes}"></apex:selectOptions>
</apex:selectList>

Please let me know how to capture value of first picklsit and based on that get the states for that country.
also how to design the custom setting so as to include the states and how to use changes in vf page.

I request the forum members to help me out urgently.

Thanks
krishna
 
Hello
I need to disable the command button in the visual force page.
I have a piece of logic which fetch data into an custom object called subscription__c.

The subscription object has a field called Mailing_List_Name__c.

IN the URL I will append a value , based on this it fetches the data.

If the Mailing_List_Name__c is empty then I want to disable the command button in visual force page.
 
public List<Subscription__c> subs;

 public BusinessObjects__c tlBU;  

 public void loadSubscriptions() {
      
  subs = [SELECT Id, Name, Active__c, Mailing_List_ID__c, Mailing_List_Name__c, Fan_ID__c, Promo_ID__c, Mailing_List_ID__r.TLA_ID__c, 
                       Mailing_List_ID__r.Territory__c 
                       FROM Subscription__c 
                       WHERE Fan_Id__c =:fan.Id];             
                
        //---------**** Territory Id & Territory Name of the Business Unit ****-----------
     try
     {
        tlBU=[select ID,Name
                     from BusinessObjects__c
                     where 
                      MID__c=:ApexPages.currentpage().getparameters().get('mid')];
      
        TerritoryCheck=tlBU.Name;

}

vf page

  <label><apex:inputCheckbox value="{!s.selection}"/></label>
                                                                 
  <apex:commandButton value="SAVE CHANGES" action="{!btn_subscription_saveChanges}" reRender="outPanelSub"/>
Please let me know how to achieve this.

Thanks
krishna

 
Hi
I have  created a custom setting whose api name is SonyMusicUK__c and added value to it as       Sony Music UK
Now in my soql I want to refer to this custom setting but I am unable to do so

SonyMusicUK__c p;  //create an object for custom setting
p=[select Name from SonyMusicUK__c];
system.debug(p);
List<subscription__c> lstsub=new List<subscription__c>();
lstsub=[select s.Mailing_List_Name__c
                               from subscription__c s
                               where s.Territory_ID__c.Territory__c LIKE (p)];
system.debug(lstsub);
system.debug(lstsub.size());

I am not getting desired result, any better way of doing this.

thanks
krishna
Hello
I have like this in my visualforce page
<apex:page controller="somename">

<apex:form>
<apex:inputHiddenField value="{!firstname}" id="hiddenfield">
<apex:inputText value="{!firstName}" id="fname" onchange="GetFirstName(this);"  />

<apex:commandButton value="Save" action="{!SaveChanges}"/>
</apex:form>
<script type="text/javascript">
  function GetFirstName(data)
  {
      var hiddenvalue=document.getElementByID('data').value;
      alert(hiddenfield);  // am getting the correct value in alert
 }
</script>
</apex:page>
Now what I require is to have value of javascript variable(hiddenvalue) in my apex controller.
I want to do some action when I click the button so inside button code I need to have the value of javascript variable.
I hope I am clear.
without using action function or apex:param is there a way to do this?

pls let me know, urgent.

thanks
krishna
Hello
I have a piece of code where as soon as the visual force page loads I mask the email id .
for ex: if emailID is jose@gmail.com, it is masked as  j***@g****.com

But before storing the field value in sobject, I need to unmask it to jose@gmail.com

any help will be greatly appreciated.
private String maskEmail (String sEmail){

         String sMaskedEmail;

         String[] aEmail = sEmail.split('@');
         if(aEmail.size() == 2){

             sMaskedEmail = aEmail[0].left(1);

             for(integer i=0; i < aEmail[0].length() - 1; i++){

                 sMaskedEmail += '*';

             }
              

             String[] aEmail2 = aEmail[1].split('\\.', 2);

             sMaskedEmail += '@' + aEmail2[0].left(1);

             for(integer i=0; i < aEmail2[0].length() - 1; i++){

                 sMaskedEmail += '*';

             }

             sMaskedEmail += '.' + aEmail2[1];
         }

         return sMaskedEmail;  

    }

thanks
krishna
 
Hello friends
I am appending a contact ID to the browser url, based on the contact ID I will fetch lastname and leadsource into the vf page for that contact ID only.

so I am trying to bind leadsource picklist values into my controller as follows for that particular contact ID only.
public class clsContact {
    public Contact contact {get; set;}
    public String lastname{get; set;}
    public List<Selectoption> leadsourcevalues{get; set;}
    String contactId {get; set;} 
   
    public clsContact(){
        contactId = ApexPages.currentPage().getParameters().get('id');
        if(contactId != null)
        {
           getContact();
        }
        else{
            contact = new Contact();
        }
 }
public void getContact() {
            contact = [SELECT Id, lastname,LeadSourcee FROM Contact WHERE Id = :contactId];
 }

<apex:page controller="clsContact" >
<apex:form >
 <apex:inputField value="{!contact.FirstName}"/>
 //Here how to get the picklist value for that particular ID
  <apex:commandButton value="Save" action="{!save}"/>
</apex:form>
</apex:page>
I am struggling here so kindly help me out.
Thanks
krishna


 
Hello friends
I have a requirement as follows. I am explaining in detail.

I have a URL say https://ap2.salesforce.com?fanID=0032800000gufvJ  in salesforce.
based on this FanID I will get the email of that user.

Now I have a visualforce page with standard controller="fan__c"
<apex:inputText name="email>

In aex controller:
string fanid="Apexpages.currentpage().getparameter('fanID');
               if fanid != NULL
  string emaladdress=[select Email from fan__c where ID=:fanID];

Now value in emailaddress should be stored in <apex:InputText name=Email>

if the email already exists it should be replaced with asterisk as follows.
for example : assume email is  jose@gmail.com and if it exists for that particular ID then the contents of <apex:inputText> should be
j***@g****.com

If email doesnt exist for that  FanID   then contents of <apex:inputText> will contain   mary@yahoo.co.in

I am literaly struggling with this so any will be rewarded with points

thanks
krishna
Hello friends
I am trying to understand inner join , left outer , right outer , anti join on soql queries.
I have written two queries below, pleae let me know what type of joins they fall in, here's where I have confusion.

How to find all parent records with associated child records?
List<Account> accList=[select Account.Name,(select contact. Name from contacts)
                                   from Account
                                   where ID IN (select AccountID from Contact)];
 
I want to display those parent records who have orphaned children
List<Account> accList=[select ID, Name from Account
                                         where ID NOT IN (select AccountID from Opportunity
                                                                        where StageName='Closed Won')];

thanks
krishna