0

Below is my controller and Visualforce page. In this i am trying to remove the Harcoded string. i am getting value in s1.Name. But from the salesforce i have to write the name like ReadyWidth only. If i Write like READYWIDTH then its not working. So any idea how can i remove this hardcoded string value and make it work with lowe and uppercase both?

Controller:-

Map<String, String> sp = new Map<String, String>();  

List<ServiceProgram__C> s = [SELECT  name,Length__c, Width__c from ServiceProgram__C where E_Product__c = :ci.ccrz__Product__r.id];

            sp.put(s1.Name,String.valueOf(Integer.valueOf(s1.Length__c))+':'+String.valueOf(s1.Width__c));  


          }

          returnObject.put('servicePrograms', sp);
          System.debug(returnObject.get('servicePrograms'));

Visual Force:-

        else if (valChanged == 'ReadyWidth') {
          $(".jsRollProductInfo").removeClass("hidden");
          $(".jsMasterPunch").addClass("hidden");
          $(".jsMasterWind").addClass("hidden");

          var allowances = $("#ReadyWidth").val();
          var parts = allowances.split(":");
          var lengths = parts[0].split(",");
          var widths = parts[1].split(",");
          $('#rollLengthText').addClass("hidden");              
          $('#rollLengthDD').removeClass("hidden");
          $('#rollLengthDD').empty();
          $.each(lengths, function (i, item) {
                            $('#rollLengthDD').append($('<option>', { 
                                value: item,
                                text : item 
                            }));
                        });
2

You can create a custom label in your Org and then refer that label in your VF page using $Label.CustomLabel where customlabel is the label you created.

You can refer the same custom label in Apex using System.Label.CustomLabel

You can ignore the Case using String.equalsIgnoreCase("String")

Please refer How to use Custom Labels in Visualforce page and Apex Class for more details

| improve this answer | |

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.