• JamesSS
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 23
    Questions
  • 20
    Replies


I have used Multiple components in VF page.

M4 Component code have overlapped in M1 component.

I have passed one variable to M4 component.

But this passed variable is showing in Page. But this value always showing as "null" in M4 Component controller constructor.
Please help to get this passed value in M4 Component controller.

My Main page code :

<apex:page sidebar="false" showHeader="false">
    <c:M1 ></c:M1>
</apex:page>


M1 Component Code:
_________________

<apex:component controller="retriveSetCon" >
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"></meta>

    <c:M2 ></c:M2>                       
                                             
    <body  style="margin-top: 1%;background-color:white" >
        <div class = "modal1">  
            <p style="position: fixed; padding-top: 25%;font-weight: bold;color: black;padding-left: 46%;font-size: 19px;" id="msgBlock"><b> Processing...</b></p>
        </div>                
        <div class="container-fluid">         
                
                    <div class="tab-content">
                    
                            <div>
                                <!-- some code -->
                                <c:M4 myValue1="AccountObject"></c:M4>
                           </div>
                       
                    </div>
        </div>

        <div>
            <c:M5 ></c:M5>
        </div>

    </body>
 
</apex:component>



M4 Component Code :
_______________________

<apex:component controller="TestComponentController">

  <apex:attribute name="myValue1" description="This is the value for the component." required = "true" type="String"  assignTo="{!myValue}"/>
  <div class="container">

  <apex:outputText value="{!myValue}" style="color:red" />
  
  <apex:dataTable value="{!taskList}" var="t">
 
    <apex:column >

        <apex:facet name="header">Name</apex:facet>

            <apex:outputText value="{!t.Name}"/>

        </apex:column>
  </apex:dataTable>
 
</div>
</apex:component>

global without sharing class TestComponentController{
    
    public String myValue{get;set;}


    public TestComponentController(){
     System.debug('myValue:::::::'+myValue);
       
    }
}


I want to get all strings length startswith "{!" and endswith "}" in given string(it will take from apex:input text area value).

refer exact output for my jsfiddle link
http://jsfiddle.net/XzS5V/5/


I am using regex for get this output.but it always reyurn null

My code:
<apex:page standardController="Account">
  <apex:includeScript value="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" />

 
  <apex:form >
      <apex:inputTextarea styleClass="myFld" style="width: 447px;height:300px;"/>
  </apex:form>
<script type="text/javascript">
  $(".myFld").keyup(function() {      
            var myFieldValue = $(this).val();
            calculateStringCounts(myFieldValue);
  });
   function calculateStringCounts(myField){
       //var filter = /\{\!\w+\}/g;
       //var filter = /([A-Z])\w+/g;
       var filter =/\{\!\w+\}+/g;
       var newArr = myField.match(filter);
       alert(newArr.length);
       return false;
    }
</script>
</apex:page>

How to align the content of left aligned in received email for HTML Email Template?Because its always it have center aligned.

How to add following meta tags in Apexpages.currentPage().getHeaders().put() in apex controller.

 

<meta name="google" value="notranslate"/>
<meta http-equiv="Content-Language" content="en"/>

 

Is it possible?

Its urgent..

How to add mre than one videos in VF page?

 

Please anyone give some example for adding videos in VF page?

How to remove  ASCII control characters  in string?

  • September 02, 2013
  • Like
  • 0

How to compare two strings equal?

 

 

In my code have two strings. Both strings are equal but one string contains ascii character.

 

How to remove ascii character from one string and how to check this in apex code?

  • September 02, 2013
  • Like
  • 0


How to cover 100% coverage for below test class.

It has covered 88% now.
Below lines didn't cover in my test class.Please help to cover this.

Uncovered Lines:
if (success) {
return pr;
}

My class:

public class password {
public String username {get; set;}

public password() {}

public PageReference forgotPassword() {
boolean success = Site.forgotPassword(username);
PageReference pr = Page.ForgotPasswordConfirm;
pr.setRedirect(true);

if (success) {
return pr;
}
return null;
}

public static testMethod void testpassword() {
password controller = new password();
controller.username = 'test@gmail.com';
}
}

Is Scheduled Apex is working in Professional Edition?

 

I am running Scheduled Apex  in Professional Edition. It status always indicates "Queued".

 

How to run this Scheduled Apex  in Professional Edition ?

 

 

I have written following javascript function for some processing.

 

In js method have more than 15 parameters to pass to Controller using Saveaccount actionFunction.

<apex:actionFunction name="Saveaccount" action="{!createSavedSearch}" ">

<apex:param assignTo="{!text1}" value=""/>

.

.

.

.

.

.

<apex:param assignTo="{!text15}" value=""/>

 </apex:actionFunction>  

 

function save(){

 

Saveaccount($('.text1').html().replace('%',''),$('.text2').html().replace('%',''),$('.text3').html().replace(/[^\d]/g,''),$('.text4').html().replace(/[^\d]/g,''),
$('.text5').html().replace('x',''),$('.text6').html().replace('x',''), $('.text7').html(),$('.text8').html(),$('.text9').html().replace('%',''),
$('.text10').html().replace('%',''),$('.text11').html(),$('.text12').html(),$('.text13').html(),$('.text14').html(),$('#text15').val()
);

 

}

 

 

How to use  data structure - a map (hash), a JS object, or a custom class in above save method?

How  to improve this action function and it's associated JS and Apex code, calling it with one parameter?

How to get the self lookup accounts in Account object in soql?

 

List <Account> AccountsList = [ SELECT Id,
Name,LastActivityDate
(select Id,Name,Owner.Name,Owner.Alias from ParentAccount)
FROM Account
WHERE ( ParentId = null)
];

 

In above soql is wrong.. please any one help to get this original soql?

How to get the Related To field value of activity in soql(this field have lot of objects including custom objects)?

 

Data Type Lookup(Contract,Campaign,Account,Opportunity,Product,Asset,Case,Solution,Asset Summary,Investor List, etc)

Investor List  is custom object.

In above data type I need to get Investor List value in soql? how to get this value in soql?

I have wrote some code for my page.

 

My page have  500 records.Each record different field values.I want to show the count of each record basis of field values.

 

So On page load, In controller I have  iterate each record and build two(values have taken from 2 different objects) dynamic soql and get the result count.But it exceed 50 th record it throws error(Query exception 101 soql queries).

 

How to avoid this in page load?Its urgent

 

 

 

 

My code:

<apex:page sidebar="false" showheader="false">
<apex:includeScript value="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" />
<script>
$(document).ready(function() {
$('input[id^="textInput"]').val('news here!');
});
</script>
<apex:form>
<apex:inputText id="textInput1"/>
<apex:inputText id="textInput2"/>
<apex:inputText id="textInput3"/>
</apex:form>
</apex:page>

 

In above code, on page load,jquery value isn't put in the textboxes.Is any error is in my code? 

My code:
Class:

public class Jserrors{
public list<Selectoption> Performance{set; get;}
public Jserrors(){
Performance = pick();
}
public list<SelectOption> pick(){

op.add(new selectOption('Prospect','Prospect');
op.add(new selectOption('Customer-Direct','Customer-Direct');
op.add(new selectOption('Other','Other');
return op;
}
}

VF code:
<apex:page controller="Jserrors">
<apex:includeScript value="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" />
<script>
$(function($) {
<script>
function save(){
$('.Radios').find('input:radio').each(function(){
alert("please select atleast one");
});
}
</script>
});
});
</script>
<apex:form >
<div>
<div style = "margin-bottom:10px;">Radios</div>
<div>
<apex:selectRadio layout="pageDirection" id = "radios" styleClass="Radios">
<apex:selectOptions value="{!Performance}"></apex:selectOptions>
</apex:selectRadio>
<button onclick = "save();">Save</button>
</div>
</div>
</apex:form>
</apex:page>

How to throw the alert error when I didn't select any one of the radio in clicking the save buuton?

I am using dynamic query in my code.

 

My code:

queryString += '( Type__c <= '+mySearch +')';

My error:


System.QueryException: value of filter criterion for field 'Type__c' must be of type string and should be enclosed in quotes

 

How to include quote in above code?

My code:

Class:

 

public class Jserrors{
public list<Selectoption> Performance{set; get;}
public Jserrors(){
Performance = pick();
}

public list<SelectOption> pick(){

op.add(new selectOption('Prospect','Prospect');
op.add(new selectOption('Customer-Direct','Customer-Direct');
op.add(new selectOption('Other','Other');
return op;
}

}

 

VF code:

<apex:page controller="Jserrors">
<apex:includeScript value="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" />
<script>
$(function($) {
$('.Radios').each(function(){
var value = $(this).val();
alert('value'+value);
});
});
</script>
<apex:form >
<div>
<div style = "margin-bottom:10px;">Radios</div>
<div>
<apex:selectRadio layout="pageDirection" id = "radios" styleClass="Radios">
<apex:selectOptions value="{!Performance}"></apex:selectOptions>
</apex:selectRadio>
</div>
</div>
</apex:form>
</apex:page>

 

In mycode have returned empty option value in page load.Is it possible to return Performance option values in page load?

String s = 'This's is correct and it's ready to replace';

How to replace the single quote ?

 

replace character : '

Replacing with : '\

My expected output:

 

This\'s is correct and it\'s ready to replace

 

Is it possible?

My input:

System.debug('Date.today();************ ' + date.today());

 

Output:

Date.today();************  2013-06-07 00:00:00

 

expected output:

Date.today();************  2013-06-07 

 

Is possible to get my expected output?

I have 100 accounts of Account Object.Every account have more than one contact.I need to getting the highest contact by the contact (percent field) in every account.

Is it possible in Map?

 

Its urgent.Please help me

How to align the content of left aligned in received email for HTML Email Template?Because its always it have center aligned.

How to get the self lookup accounts in Account object in soql?

 

List <Account> AccountsList = [ SELECT Id,
Name,LastActivityDate
(select Id,Name,Owner.Name,Owner.Alias from ParentAccount)
FROM Account
WHERE ( ParentId = null)
];

 

In above soql is wrong.. please any one help to get this original soql?

My code:

<apex:page sidebar="false" showheader="false">
<apex:includeScript value="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" />
<script>
$(document).ready(function() {
$('input[id^="textInput"]').val('news here!');
});
</script>
<apex:form>
<apex:inputText id="textInput1"/>
<apex:inputText id="textInput2"/>
<apex:inputText id="textInput3"/>
</apex:form>
</apex:page>

 

In above code, on page load,jquery value isn't put in the textboxes.Is any error is in my code? 

My code:
Class:

public class Jserrors{
public list<Selectoption> Performance{set; get;}
public Jserrors(){
Performance = pick();
}
public list<SelectOption> pick(){

op.add(new selectOption('Prospect','Prospect');
op.add(new selectOption('Customer-Direct','Customer-Direct');
op.add(new selectOption('Other','Other');
return op;
}
}

VF code:
<apex:page controller="Jserrors">
<apex:includeScript value="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" />
<script>
$(function($) {
<script>
function save(){
$('.Radios').find('input:radio').each(function(){
alert("please select atleast one");
});
}
</script>
});
});
</script>
<apex:form >
<div>
<div style = "margin-bottom:10px;">Radios</div>
<div>
<apex:selectRadio layout="pageDirection" id = "radios" styleClass="Radios">
<apex:selectOptions value="{!Performance}"></apex:selectOptions>
</apex:selectRadio>
<button onclick = "save();">Save</button>
</div>
</div>
</apex:form>
</apex:page>

How to throw the alert error when I didn't select any one of the radio in clicking the save buuton?

I am using dynamic query in my code.

 

My code:

queryString += '( Type__c <= '+mySearch +')';

My error:


System.QueryException: value of filter criterion for field 'Type__c' must be of type string and should be enclosed in quotes

 

How to include quote in above code?

My code:

Class:

 

public class Jserrors{
public list<Selectoption> Performance{set; get;}
public Jserrors(){
Performance = pick();
}

public list<SelectOption> pick(){

op.add(new selectOption('Prospect','Prospect');
op.add(new selectOption('Customer-Direct','Customer-Direct');
op.add(new selectOption('Other','Other');
return op;
}

}

 

VF code:

<apex:page controller="Jserrors">
<apex:includeScript value="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" />
<script>
$(function($) {
$('.Radios').each(function(){
var value = $(this).val();
alert('value'+value);
});
});
</script>
<apex:form >
<div>
<div style = "margin-bottom:10px;">Radios</div>
<div>
<apex:selectRadio layout="pageDirection" id = "radios" styleClass="Radios">
<apex:selectOptions value="{!Performance}"></apex:selectOptions>
</apex:selectRadio>
</div>
</div>
</apex:form>
</apex:page>

 

In mycode have returned empty option value in page load.Is it possible to return Performance option values in page load?

String s = 'This's is correct and it's ready to replace';

How to replace the single quote ?

 

replace character : '

Replacing with : '\

My expected output:

 

This\'s is correct and it\'s ready to replace

 

Is it possible?

My input:

System.debug('Date.today();************ ' + date.today());

 

Output:

Date.today();************  2013-06-07 00:00:00

 

expected output:

Date.today();************  2013-06-07 

 

Is possible to get my expected output?

I am writing testclass for the belowing code.In that code 'List<List<SObject>> searchList = [Find : account.Name RETURNING Lead (Id, Name, Company, Owner.Name, Title, Phone, email, Status WHERE Status = 'Open' AND Company like :Names) ]; isn''t covering.How to cover this line?Anyone help to cover this?

 

public class TestController {

public Account Testaccount {get;set;}

public TestController() {

String accountId = ApexPages.CurrentPage().getParameters().get('Id');

if (accountId != NULL) {

account = [ SELECT Id, Name FROM Account WHERE Id =: accountId ];

String Names = account.Name+'%';
List<List<SObject>> searchList = [Find : account.Name RETURNING Lead (Id, Name, Company, Owner.Name, Title, Phone, email, Status WHERE Status = 'Open' AND Company like :Names) ];

List<Lead> leadLists = searchList[0];

}
}

}


@isTest(SeeAllData=true)
public class TController{
static testMethod void TController () {

Account acc = new Account(Name = 'Test11');
insert acc;

Lead testLead1 = new Lead (Status = 'Open',LastName = 'Test1',Email = 'gggg@gmail.com',Company = 'Test11-1',Phone = '1234545');
insert testLead1 ;
Lead testLead2 = new Lead(LastName = 'Test111-2', Company = 'Test11-2', Status = 'Open',Phone = '123345456');
insert testLead2;
System.assertEquals(testLead2.LastName , 'Test111-2');
ApexPages.CurrentPage().getParameters().put('Id',acc.Id);
TestController tlc = new TestController();

}
}

How to use \n in inside of string? I have used.But its not working.Is any one to find the error in my code? My code Vf page : This is your new Page {!Testvariable } Controller: public with sharing class Test { public string Testvariable{get;set;} public Test (){ Testvariable = 'Male\n\nFemale'; } }