• Leticia Monteiro Freitas 4
  • NEWBIE
  • 59 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 30
    Questions
  • 21
    Replies
Hi, 

I'm trying use a component in a Community, but when I acess the community without login I cant see the component.

Can anyone help me ?
Hi, 
I trying to change the size of modal close button. Can Anyone help me?User-added image
modalBody = content;
                component.find('overlayLib').showCustomModal({
                    body: modalBody, 
                    showCloseButton: true,
                    cssClass: "mymodal slds-modal_medium",
                    closeCallback: function() {
                        
                    }
                })


 
Hello, 

I've created a modal using showCustomModal, and I want chage the size of close button. 
Can anyone help me ?

User-added image
Hello, 

I'm Trying use a input type radio, and want see if is checked. 
How could I do that?
Hello, I'm trying to use the tag < input type="date" /> but when I use my date is formated like "mm/dd/yyyy".
Can anyone can show how change to: "dd/mm/yyyy"?
Hello, 

I'm using lightning input date on my component. But when I type the values from the keyboard my component didint reconigze the the values. 
Anyone already seen this?
Hello, 

How I can check if my date input is a valid date - not just a number in formatt like 02/29/2019 or 99/99/9999? 
I'm using an controller class in lightninc component.

 
I'm creating a component that uses a lightning input field that sets a messageWhenBadInput atributte. But when I deployed this code dosent work anymore.
 
<div class="slds-grid slds-gutters">
                            <div class="slds-col slds-size_3-of-12">
                                <div class="slds-p-left_xx-small" >
                                    <lightning:input aura:id="startDate"  type="date" required="true" fieldName="startDate" label="Data início" value="{!v.dataInValue}" messageWhenBadInput="Sua entrada não corresponde ao formato permitido dd/mm/aaaa."/>
                                </div>
                            </div>

User-added image

User-added image
I have a lighting input - type:date and I wann change this messages? Can anyone show me ?

User-added image
Hello, I had an apex class that makes a call from rest api and return a json that I deserialize and transform an object list. 
Anyone can tell me how to show this list in lightning datatable ?
I have a modal component that was called from another Component. I nedd to close the modal. How can I do that?
Hello, 

I'm trying read a value from my lightning input that has a date type, but when i use component.find.get my return value is undefined. Can anyone could help me ?
<aura:component >
    <aura:attribute name="dataInValue" type="date" />
    <aura:attribute name="dataEndValue" type="date"/>
    <section role="dialog" tabindex="-1" aria-labelledby="modal-heading-01" aria-modal="true" aria-describedby="modal-content-id-1" class="slds-modal slds-modal_small slds-slide-up-open slds-align_absolute-center">
        <div class="slds-modal__container">
            <header class="slds-modal__header">
                
                <button class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse" title="Close">
                    <span class="slds-assistive-text">Close</span>
                </button>
                
                
                <div class="slds-text-title slds-p-top_xxx-small slds-p-left-none" style="font-weight: bold">FILTRAR EXTRATOS:</div>
                
                <div style="border-bottom: 1px solid #dddbda; margin-top: 5px"></div>  
                
                <div class="slds-grid slds-gutters">
                    <div class="slds-col slds-size_3-of-12">
                        <div class="slds-p-left_xx-small" >
                            <lightning:input aura:id="startDate" type="date" fieldName="startDate" label="Data-Início" value="{!v.dataInValue}" onkeypress="{!c.validDateSize}" onchange="{!c.validDate}"/>
                        </div>
                    </div>
<aura:component>

Controller.js
validDate : function(component,event,helper){
    // alert('Entrou na ValidDate');
     var data_inicio = component.find("startDate").get("v.value");
     var data_fim = component.find("endDate").get("v.value");
     var sub; 
        if(data_inicio){
            sub = data_inicio.replace(/[^0-9]/g,'');
            component.set("v.dataInValue", sub);
            var tam = sub.lenght;
            if(tam > 10){
                var res = sub.replace(/(\d{3})(\d{3})(\d{4})/, "$1/$2/$3/");
                component.set("v.dataInValue",res);
            }
        }
        
    },
    
    validDateSize : function(component,event,helper){
    var data_inicio = component.find("startDate").get("v.value");
        console.log("Stardt Date:"+component.find("startDate").get("v.value"));
    var data_fim = component.find("endDate").get("v.value");   
    var sel = window.getSelection().toString();
    console.log('entra no validate size');
    console.log('Data Ini'+data_inicio);

    if(data_inicio != null)
        {
            console.log('Entra no if');
            var tam = data_inicio.length;
            console.log('Tam:'+tam);
           if(tam > 10 && sel ==''){
                event.preventDefault();
            }
        }
        
        if(data_fim){
            var tam = data_fim.lenght;
            if(tam>10 && sel == ''){
                event.preventDefault();
            }
        }
      }
})

​​​​​​​

 
Hello, 

How I can use the function on paste in lightning component? Anyone already use jquery in lightining?
Hello, 

I'm trying to pass a jquery file for an lightning component.
 
<!--HTML-->  
<ltng:require scripts="{!$Resource.jQuery2}" afterScriptsLoaded="{!c.doInit}" />
 
doInit : function(component, event, helper) {
        
        jQuery("document").ready(function(){console.log('loaded');});
}

But I'm getting the following error:
[jQuery is not defined] - I​​ JS didint recognize the jquery. Can anyone help me?
 
Hello, I'm trying to create a lightning input that when a value is copy-and-paste, this input format the value according a predefined mask.
I'ts working for a typing, but when I paste my component.get is entry like empty.
Can anyone help me?
Hello,

I'm trying populate a lightning combobox with a value from a specific PickList Fiel. Could anyone help me?
 
Hello, 

I need to setup a lightning input data that should has a mask.
When the user digits a cell-phone - it's should be formatted in screen.
(xx) xxx-xxxx
Can anyone help me ?
 
Hello, 

I need set a mask on my lightning input text, to get de Data Format. (YYYY-MM-DD)
Can anyone could help me?

 
Hello, 

Is there anyway to know how much time takes to my query execute?
Hello, I'm trying to make a Lightning component that makes a search in Account and returns results. But, I get the following error:
My variable input_text gets undefiened, even after user get.component. 
Can anyone help me?


User-added image
My code:
Class:

/*Versão 3.00 - US_179 - Leticia Freitas - 13/11 
Classe que recebe uma string, determina se é um cpf ou um cnpj e a partir dele, realiza a busca dessa conta. 
Caso exista o registro, retorna as informações: Nome, Tipo de Documento (CPF ou CNPJ), Número do documento, Número do Documento Formatado, Logradouro, CEP, Cidade e Estado.
*/

public class CEC_SearchAccount{   
     
    
    
    public static List<Account> getfoundAccount(String Key, String documentType)
    {
       List<Account> Conta  = [Select ID, Name, DocumentType__c,DocumentNumber__c,FormattedDocument__c,BillingAddress from Account 
       where DocumentNumber__c =:Key  AND DocumentType__c =:documentType];

            return Conta;
         
           
        
    }
    
    public static void getvalidCPF(String CPF)
    {
        /* Cálcula se o cpf é valido através do cálculo dos digitos validadores.*/
        integer value; 
        integer coeff = 10, sum, rest;
        String dig10,dig11;
        
        
        //Calcula o primeiro digito validador do CPF
        for(integer i=0; i<9;i++)
        {
            value = Integer.valueOf(CPF.substring(i,1))* coeff;
            coeff--;
            sum =   sum + value ;
        }
        
        rest = 11 - math.mod(sum,11);
        if((rest == 10) || (rest == 11))
        {
            dig10 = '0';
        }else{
            dig10 = String.valueOf(rest);
        }
        
        sum = 0;
        coeff = 11;
        value = 0;
        
        for(integer i=0;i<10;i++)
        {
            value = Integer.valueOf(CPF.substring(i,1))*coeff;
            coeff--;
            sum = sum + value;
            
        }   
        rest = 11 - math.mod(sum,11);
        
        if((rest == 10) || (rest==11))
        {
            dig11 = '0';
        }else{
            dig11=String.valueOf(rest);
        }
        
        // Validate if the calculus match
        if((dig11 == cpf.substring(0,11)) && (dig10 == cpf.substring(0,10)))
        {
           String documentType = 'CPF';
            getfoundAccount(CPF,documentType);
        }else{
         system.debug('CNPJ iNVÁLIDO');
        }
    }
    
    
    
    public static void getvalidCNPJ(String CNPJ)
    {
        integer value;
        integer coeff=12,sum,rest;
        String dig13,dig14;
               
        for(integer i = 0; i < 12;i++)
        {
            value = Integer.valueOf(CNPJ.substring(i,1)) * coeff;
            coeff--;
            sum = sum + value;
        }
        
        rest =Math.mod(sum,11);
        
        if((rest == 0) || (rest == 1))
        {
            dig13 = '0';
        }else{
            dig13 = String.valueOf(11 - rest);
        }
        
        // Calculando o segundo digito verificador do CNPJ
        
        rest=0;
        coeff=13;
        
        for(integer i = 0;i<13;i++)
        {
            value = Integer.valueOf(CNPJ.substring(i,1)) * coeff;
            coeff--;
            sum = sum + value;
        }
        
        rest = math.mod(sum,11);
        
        if((rest == 0) || (rest == 1))
        {
            dig14 = '0';
        }else{
            dig14 = String.valueOf(11 - rest);
        }
        
        if((CNPJ.substring(0,13) == dig13) && (CNPJ.substring(0,14)== dig14))
        {
           String documentType ='CNPJ';
            getfoundAccount(CNPJ, documentType);
        }else{
            //
        }
    }
    
    @AuraEnabled
    Public static void getvalidKey(String text)
    {
        /*Após ler a string de caracteres, o sistema chama a função de cpf ou cnpj conformo o tamanho da string */
        system.debug('Chegou na função da classe agora o/');
        //integer tamanho = text.length();
        system.debug('Tamanho:');
        system.debug('Texto:'+text);
        
        system.debug(text.length());
            
        if(text.length() == 11)
        {
            getvalidCPF(text);
        }else if(text.length() == 14)
        {
            getvalidCNPJ(text);
        }else{
            system.debug('CPF/CNPJ Inválido');
        }
    }
    
 }

Controller:
({
    /* Dentro da ação de clicar no botão, a classe controladora aponta para a função validKey*/
   
    handleClick : function(component, event, helper) {
        var action = component.get("c.getvalidKey"); 
        
        var input_text = component.get("v.searchText");
        console.log("input_text"+ input_text);
        debugger;
        action.setParams({"text":input_text});
        
        action.setCallback(this,function(response)
        {
          var state = response.getState();x
        if(component.isValid() && STATE==Sucess){
            component.set("v.acctList",response.getReturnValue());
        }
        });
        $A.enqueueAction(action);
    }
})

Cmp:
<aura:component controller="CEC_SearchAccount" implements="force:appHostable">
   
    <aura:attribute name="acctList" type="Account[]" />
    <lightning:input name="searchText" label="Insira o CPF ou CNPJ" />
    <lightning:button variant="brand" label="Buscar" onclick="{!c.handleClick}"/>
    
    
    <aura:iteration items="{!v.acctList}" var="a">
        <p>{!a.Name},{!a.Type}</p>
    </aura:iteration>
    
</aura:component>
Hello, 

I've created a modal using showCustomModal, and I want chage the size of close button. 
Can anyone help me ?

User-added image
Hello, 

I'm Trying use a input type radio, and want see if is checked. 
How could I do that?
Hello, 

I'm using lightning input date on my component. But when I type the values from the keyboard my component didint reconigze the the values. 
Anyone already seen this?
I have a lighting input - type:date and I wann change this messages? Can anyone show me ?

User-added image
Hello, 

I'm trying read a value from my lightning input that has a date type, but when i use component.find.get my return value is undefined. Can anyone could help me ?
<aura:component >
    <aura:attribute name="dataInValue" type="date" />
    <aura:attribute name="dataEndValue" type="date"/>
    <section role="dialog" tabindex="-1" aria-labelledby="modal-heading-01" aria-modal="true" aria-describedby="modal-content-id-1" class="slds-modal slds-modal_small slds-slide-up-open slds-align_absolute-center">
        <div class="slds-modal__container">
            <header class="slds-modal__header">
                
                <button class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse" title="Close">
                    <span class="slds-assistive-text">Close</span>
                </button>
                
                
                <div class="slds-text-title slds-p-top_xxx-small slds-p-left-none" style="font-weight: bold">FILTRAR EXTRATOS:</div>
                
                <div style="border-bottom: 1px solid #dddbda; margin-top: 5px"></div>  
                
                <div class="slds-grid slds-gutters">
                    <div class="slds-col slds-size_3-of-12">
                        <div class="slds-p-left_xx-small" >
                            <lightning:input aura:id="startDate" type="date" fieldName="startDate" label="Data-Início" value="{!v.dataInValue}" onkeypress="{!c.validDateSize}" onchange="{!c.validDate}"/>
                        </div>
                    </div>
<aura:component>

Controller.js
validDate : function(component,event,helper){
    // alert('Entrou na ValidDate');
     var data_inicio = component.find("startDate").get("v.value");
     var data_fim = component.find("endDate").get("v.value");
     var sub; 
        if(data_inicio){
            sub = data_inicio.replace(/[^0-9]/g,'');
            component.set("v.dataInValue", sub);
            var tam = sub.lenght;
            if(tam > 10){
                var res = sub.replace(/(\d{3})(\d{3})(\d{4})/, "$1/$2/$3/");
                component.set("v.dataInValue",res);
            }
        }
        
    },
    
    validDateSize : function(component,event,helper){
    var data_inicio = component.find("startDate").get("v.value");
        console.log("Stardt Date:"+component.find("startDate").get("v.value"));
    var data_fim = component.find("endDate").get("v.value");   
    var sel = window.getSelection().toString();
    console.log('entra no validate size');
    console.log('Data Ini'+data_inicio);

    if(data_inicio != null)
        {
            console.log('Entra no if');
            var tam = data_inicio.length;
            console.log('Tam:'+tam);
           if(tam > 10 && sel ==''){
                event.preventDefault();
            }
        }
        
        if(data_fim){
            var tam = data_fim.lenght;
            if(tam>10 && sel == ''){
                event.preventDefault();
            }
        }
      }
})

​​​​​​​

 
Hello,

I'm trying populate a lightning combobox with a value from a specific PickList Fiel. Could anyone help me?
 
Hello, 

I need to setup a lightning input data that should has a mask.
When the user digits a cell-phone - it's should be formatted in screen.
(xx) xxx-xxxx
Can anyone help me ?
 
Hello, 

I need set a mask on my lightning input text, to get de Data Format. (YYYY-MM-DD)
Can anyone could help me?

 
Hello,

I'm trying display a message error on lightning component when i get some error on my apex class, like when my select returns zero records.Or my field doesent have the rigth formatt.

Please, can anyone could help me?

 
I'm Trying display the result of my query in salesforce lightning component, but when I hava recieve this error:
User-added image
My code:

class:
/*Versão 3.00 - US_179 - Leticia Freitas - 13/11 
Classe que recebe uma string, determina se é um cpf ou um cnpj e a partir dele, realiza a busca dessa conta. 
Caso exista o registro, retorna as informações: Nome, Tipo de Documento (CPF ou CNPJ), Número do documento, Número do Documento Formatado, Logradouro, CEP, Cidade e Estado.
*/

public class CEC_SearchAccount{   
     
    
    
    public static List<Account> getfoundAccount(String Key, String documentType)
    {
        system.debug('Entrou na busta de conta');
       List<Account> Conta  = [Select  Name from Account 
       where DocumentNumber__c =:Key  AND DocumentType__c =:documentType];

        
        if(Conta != NULL)
        {
            system.debug('Tem registros');
        }
            return Conta;
         
          
        
    }
    
    public static void getvalidCPF(String CPF)
    {
        /* Cálcula se o cpf é valido através do cálculo dos digitos validadores.*/
        integer value; 
        integer coeff = 10, sum=0, rest;
        String dig10,dig11;
        
        system.debug('Entrou na getValidCPF');
        
        //Calcula o primeiro digito validador do CPF
        for(integer i=0; i<9;i++)
        {
            system.debug('I: '+ i);
            system.debug('Coeff: '+ coeff);
            value = Integer.valueOf(CPF.substring(i,i+1))* coeff;
            system.debug('Valor da Substring:'+ value);
            coeff--;
            system.debug('Coeff depois do incremento:'+ coeff);
            sum = sum + value ;
            system.debug('Sum:'+ sum);
        }
        
        rest = 11 - math.mod(sum,11);
        system.debug('Resto:'+rest);
        
        if((rest == 10) || (rest == 11))
        {
            dig10 = '0';
        }else{
            dig10 = String.valueOf(rest);
        }
        
        sum = 0;
        coeff = 11;
        value = 0;
        rest =0;
        
        system.debug('Começou a lógica do digito 10');
        for(integer i=0;i<10;i++)
        {
            system.debug('I: '+ i);
            system.debug('Coeff: '+ coeff);
            value = Integer.valueOf(CPF.substring(i,i+1))*coeff;
            coeff--;
            sum = sum + value;
            system.debug('Coeff depois do incremento:'+ coeff);
            system.debug('Soma'+ sum);
        
        }   
        system.debug('Soma fora do loop'+ sum);
        system.debug('Resto antes da função'+rest);
        
        integer restb = math.mod(sum,11);
        rest = 11 - restb;
        
        
        system.debug('Res normal'+rest);
        
        if((rest == 10) || (rest ==11))
        {
            dig11 = '0';
        }else{
            
            dig11=String.valueOf(rest);
            system.debug('Entrou no if do dig 11');
        }
        
        system.debug('CPF dig 11'+cpf.substring(10,11));
        system.debug('CPF dig 10'+cpf.substring(9,10));
        system.debug('DIG 11'+dig11);
        system.debug('DIG 10'+dig10);
        
        // Validate if the calculus match
        if((dig11 == cpf.substring(10,11)) && (dig10 == cpf.substring(9,10)))
        { 
            system.debug('Match');
            String documentType = 'CPF';
            getfoundAccount(CPF,documentType);
        }else{
         system.debug('CNPJ iNVÁLIDO');
        }
    }
    
    
    
    public static void getvalidCNPJ(String CNPJ)
    {
        integer value;
        integer coeff=12,sum,rest;
        String dig13,dig14;
               
        for(integer i = 0; i < 12;i++)
        {
            value = Integer.valueOf(CNPJ.substring(i,1)) * coeff;
            coeff--;
            sum = sum + value;
        }
        
        rest =Math.mod(sum,11);
        
        if((rest == 0) || (rest == 1))
        {
            dig13 = '0';
        }else{
            dig13 = String.valueOf(11 - rest);
        }
        
        // Calculando o segundo digito verificador do CNPJ
        
        rest=0;
        coeff=13;
        
        for(integer i = 0;i<13;i++)
        {
            value = Integer.valueOf(CNPJ.substring(i,1)) * coeff;
            coeff--;
            sum = sum + value;
        }
        
        rest = math.mod(sum,11);
        
        if((rest == 0) || (rest == 1))
        {
            dig14 = '0';
        }else{
            dig14 = String.valueOf(11 - rest);
        }
        
        if((CNPJ.substring(0,13) == dig13) && (CNPJ.substring(0,14)== dig14))
        {
           String documentType ='CNPJ';
            getfoundAccount(CNPJ, documentType);
        }else{
            //
        }
    }
    
    @AuraEnabled
    Public static void getvalidKey(String text)
    {
        /*Após ler a string de caracteres, o sistema chama a função de cpf ou cnpj conformo o tamanho da string */
        system.debug('Chegou na função da classe agora o/');
        
        system.debug('Texto:'+text);
        
        system.debug(text.length());
            
        if(text.length() == 11)
        {   system.debug('CPF');
            getvalidCPF(text);
        }else if(text.length() == 14)
        {
            system.debug('CNPJ');
            getvalidCNPJ(text);
        }else{
            system.debug('CPF/CNPJ Inválido');
        }
    }
    
 }

Component:
<aura:component controller="CEC_SearchAccount" implements="force:appHostable">
   
    <aura:attribute name="acctList" type="Account[]" />
<b>    <lightning:input aura:id="searchText" name="searchText" label="Enter some text" onblur="{! c.handleBlur }"/>
</b><lightning:button variant="brand" label="Buscar" onclick="{!c.handleClick}"/>
    
    
    <aura:iteration items="{!v.acctList}" var="a">
        <p>{!a.Name}</p>
    </aura:iteration>
    
</aura:component>

Controller:
({
    /* Dentro da ação de clicar no botão, a classe controladora aponta para a função validKey*/
   
    handleClick : function(component, event, helper) {
        var action = component.get("c.getvalidKey"); 
        var input_text = component.find("searchText").get("v.value"); 
        console.log("input_text"+ input_text);
        debugger;
        action.setParams({"text":input_text});
        
        action.setCallback(this,function(response)
        {
          var state = response.getState();x
        if(component.isValid() && STATE==Sucess)
        {
            component.set("v.acctList",response.getReturnValue());
        }
        });
        $A.enqueueAction(action);
    }
})