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

  • Chatter
    Feed
  • 0
    Best Answers
  • 2
    Likes Received
  • 0
    Likes Given
  • 39
    Questions
  • 26
    Replies
Hi, I'm trying to call a Vf page from a lightning button inside a lightning component, and it works fine,except to set my param:

 
<!-- ccomponnet controller>

 openPdf : function(component, event, helper){
       var url = '/apex/nameOFPage?week=23';
         
       var urlEvent = $A.get("e.force:navigateToURL");
        urlEvent.setParams({
            "url":url
        });
        urlEvent.fire(); 
    },


<!---- vfpagecontroller  -->

public class weekCTRL{
    
  public integer week  {get;set;}

    
    public Forecast_CTR_renderTable(){
      
    }
}
Hello, I'm rendering a base64 file to pdf in a lightning component. Using the model of kummark22 (https://github.com/kumarrk21/PDFViewer)

But in this way I cant download. Can anyone help me?
I'm trying to use a image inside a table, and when I click on it, should call a function an pass a parameter. But when I use the tag<img> inside the tag<a> the parameter is set as null. 

Could anyone help me?
!--- comp
 <a  data-ex="{!contSubIndex}" onclick="{!c.expandTVSubTable}">
                                                                                            <img src="{!$Resource.v360IconeMais}"/>
 
                                                                                       </a>
Controller

 
var index = event.target.getAttribute('data-ex');
        alert(index);
Hi,

I'm trying to render a base64 file that comes from a rest call to a pdf to show in a lightning component. Anyone know how to do that?
Hi, 

i'm trying align my button "Buscar "with my lightining input in this screen:

User-added image
 Following my code:
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,force:hasRecordId">
    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
    <aura:attribute name="contractNumber" type="String"/>
    <aura:attribute name="startDate" type="String"/>
    <aura:attribute name="endDate" type="String"/>
    <aura:attribute name="protocolNumber" type="String"/>
    <div class="slds-grid slds-gutters">
        <div class ="slds-col slds-size_2-of-12">
            <p>Contrato</p>
            <lightning:combobox disabled="{!v.documentType}" aura:id="cmbAsset" value="{!v.contractNumber}" 
                                onchange="{!c.onRadio}" placeholder="Selecione um contrato"
                                />
        </div>
        
        <div class="slds-col  slds-size_5-of-12">
            <span class="slds-radio">
                <input type="radio" aura:id="radioData" checked="true" 
                       id="dataRadio" name="tipoBusca" value="dataRadio" onclick="{!c.getOptionsData}" />
                <label class="slds-radio__label" for="dataRadio">
                    <span class="slds-radio_faux"></span>
                    <span class="slds-form-element__label">Por data:</span>
                </label>
            </span>
            
            <div class="slds-grid">
                <div class="slds-col slds-size_1-of-2">
                    <lightning:input aura:id="startDate" type="date" value="{!v.startDate}" max="{!v.maxDate}" min="{!v.minDate}"
                                     messageWhenBadInput="Data inválida." 
                                     />
                </div>
                <div class="slds-col slds-size_1-of-2">
                    <lightning:input aura:id="startDate" type="date" value="{!v.endDate}" max="{!v.maxDate}" min="{!v.minDate}"
                                     messageWhenBadInput="Data inválida."  />
                </div>
            </div>
        </div>
        
        
        <div class="slds-col  slds-size_3-of-12">
            <span class="slds-radio">
                <input type="radio" aura:id="radioNumber"  id="number"
                       name="tipoBusca" value="number" onclick="{!c.getOptionsNumber}" />
                <label class="slds-radio__label" for="number">
                    <span class="slds-radio_faux"></span>
                    <span class="slds-form-element__label">ou número de protocolo:</span>
                </label>
            </span>
            <lightning:input   aura:id="protocolNumber" class="tallTextArea" value="{!v.protocolNumber}" 
                             maxlength="20" />
        </div>
        <div class="slds-col slds-size_2-of-12">
            <div class="slds-m-top_x-large">
                <lightning:button label="Buscar" iconName="utility:search" iconPosition="left"
                                  onclick="{!c.callProtocols}"  disabled="{!v.disabledButton}">
                </lightning:button>
            </div>
        </div>
    </div> 
    
    
    
</aura:component>

 
Hello, 

I need to create a lightining component with a button that calls a standard action to create a case. Is there possible?
Hi, 

I'm trying use a Database.query passing a string and a should use a like with operator '%'+a+'%.

String codeName ;
String query = 'Select ID, Name from Account where codeName like '%' + codeName + '%'.
What is the right syntax? 
See the string codeName is a variable not a literal string. 
Hello, I need disable the function click on the title of section , in tha way my section only open from a button.
Is there possible?
Hello, 

I'm want open a section in my lightning:accordion automatically from a click in one button.
Is there possibel?
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 ?
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?

 
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 need to create a lightining component with a button that calls a standard action to create a case. Is there possible?
Hello, 

I'm want open a section in my lightning:accordion automatically from a click in one button.
Is there possibel?
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?