> ## Knowledge Base Index
> Fetch the complete knowledge base index at: https://ajuda.greatsoftwares.com.br/sitemap.xml
> Use this file to discover available pages before exploring further.
> Pure-Markdown content can be obtained by appending a '.md' suffix to the content URLs listed in the sitemap (without the trailing slash).

# How to CONVERT VARIABLES submitted in a FORM

To convert the data submitted by a lead on the conversion page so it is automatically filled in on a thank you page, follow the tutorial below.

|| The first step is to **create and publish both pages** (conversion page and thank you page). Once both are ready, you can follow the next instructions.

###### Settings on the conversion page

1. Open the page editor and click on **"Edit"** on the form;

![](https://storage.crisp.chat/users/helpdesk/website/-/a/6/a/b/a6ab90d8350d6000/image_xvyvic.png)

2. When you do that, the Configure menu will open on the right side of the screen. In the **"**Redirect link**"** field, add the link of your thank you page to unlock the advanced form settings. Then click on **"**Advanced settings**"**;

![](https://storage.crisp.chat/users/helpdesk/website/-/a/6/a/b/a6ab90d8350d6000/image_l1gf0x.png)

3. After that, a box will open on the screen where you need to enable sending the form data in the redirect;

![](https://storage.crisp.chat/users/helpdesk/website/-/a/6/a/b/a6ab90d8350d6000/image_13a37wp.png)

4. Next, the form variable settings will open. In the fields where you enter the variables, they must be written without spaces or special characters, just like in the example below;

![](https://storage.crisp.chat/users/helpdesk/website/-/a/6/a/b/a6ab90d8350d6000/image_15aevcp.png)

5. Finally, click on **"save"** and move on to the next configuration step. And don't forget to update your page, so that these changes are sent to the published page.

###### Settings on the thank you page

1. Open the page editor and **add to the page text** (where you want the data conversion to happen) **exactly the same variable** you configured in the form on the conversion page.

|| The variable must be between braces "{}" and exactly the same as the one configured on the conversion page.

![](https://storage.crisp.chat/users/helpdesk/website/-/a/6/a/b/a6ab90d8350d6000/image_1dserfx.png)

2. Then, click the **gear icon** in the top right corner of the screen;

![](https://storage.crisp.chat/users/helpdesk/website/-/a/6/a/b/a6ab90d8350d6000/click-ingre_14dj6jt.png)

3. And click on "Javascript & CSS";

![](https://storage.crisp.chat/users/helpdesk/website/-/a/6/a/b/a6ab90d8350d6000/click-javaecss_wgt1yv.png)

4. Click to **"add** Code**"**;

![](https://storage.crisp.chat/users/helpdesk/website/-/a/6/a/b/a6ab90d8350d6000/image_1lktwa3.png)

5. Then a box will open where you need to add the name of your code, select the **"**Operation**"** option and add the entire code below to the **"**Code**"** field (just like in the example). This code is what makes the variable inserted on the page be replaced by the lead's data;

```
<script>
/* Função para pegar os parametros na url */
function URLToArray (url){
    var request = {};
    if(url.indexOf('?') !== -1){
        var pairs = url.substring(url.indexOf('?') + 1).split('&');
        for (var i = 0; i < pairs.length; i++) {
            if (!pairs[i]) continue;
            var pair = pairs[i].split('=');
            request[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1]);
        }
    }
    return request;
}
/* Função para atualizar os dados em elementos */
function AtualizarInformacoes(limpar){
    if(limpar == undefined){ limpar = false;}
    var dados = Object.entries(URLToArray(window.location.href)), total_dados = 0;
    if(dados.length == 0 || limpar){
        dados = {'(.*?)':''};
        dados = Object.entries(dados);
    }
    total_dados = dados.length;
    if(total_dados){
        var elementos = document.getElementsByClassName('gpc-e');
        if(elementos){
            var total = elementos.length;
            for (var i = 0; i < total; i++) {
                if(elementos[i].classList.contains('e_formulario')){
                    var campos = elementos[i].getElementsByTagName('INPUT'), total_campos = 0;
                    total_campos = campos.length;
                    if(campos.length){
                        for (var y = 0; y < total_campos; y++) {
                            var valor = campos[y].value;
                            if(valor){
                                for (var x = 0; x < total_dados; x++) {
                                    var regex = new RegExp('{'+dados[x][0]+'}', 'gm');
                                    valor = valor.replace(regex,dados[x][1]);
                                }
                                campos[y].value = valor;
                            }
                        }
                    }
                    var campos = elementos[i].querySelectorAll('.gpc_campos-titulo, .gpc_campos-texto'), total_campos = 0;
                    total_campos = campos.length;
                    if(campos.length){
                        for (var y = 0; y < total_campos; y++) {
                            var conteudo = campos[y].innerHTML;
                            if(conteudo){
                                for (var x = 0; x < total_dados; x++) {
                                    var regex = new RegExp('{'+dados[x][0]+'}', 'gm');
                                    conteudo = conteudo.replace(regex,dados[x][1]);
                                }
                                campos[y].innerHTML = conteudo;
                            }
                        }
                    }
                } else if(elementos[i].classList.contains('e_faq')){
                    var campos = elementos[i].querySelectorAll('.gac-item_cabecalho_titulo, .gac-item_conteudo'), total_campos = 0;
                    total_campos = campos.length;
                    if(campos.length){
                        for (var y = 0; y < total_campos; y++) {
                            var conteudo = campos[y].innerHTML;
                            if(conteudo){
                                for (var x = 0; x < total_dados; x++) {
                                    var regex = new RegExp('{'+dados[x][0]+'}', 'gm');
                                    conteudo = conteudo.replace(regex,dados[x][1]);
                                }
                                campos[y].innerHTML = conteudo;
                            }
                        }
                    }
                } else if(elementos[i].classList.contains('e_botao') || elementos[i].classList.contains('e_imagem') || elementos[i].classList.contains('e_icone') || elementos[i].classList.contains('e_texto') || elementos[i].classList.contains('e_titulo') || elementos[i].classList.contains('e_html')){
                    var conteudo = elementos[i].innerHTML;
                    for (var x = 0; x < total_dados; x++) {
                        var regex = new RegExp('{'+dados[x][0]+'}', 'gm');
                        conteudo = conteudo.replace(regex,dados[x][1]);
                    }
                    elementos[i].innerHTML = conteudo;
                }
            }
        }
    }
    if(!limpar){AtualizarInformacoes(true); }
}
AtualizarInformacoes();
$('body').on('click','.link_popup',function(){ setTimeout(function(){ AtualizarInformacoes(); },100); });
</script>
```
![](https://storage.crisp.chat/users/helpdesk/website/-/a/6/a/b/a6ab90d8350d6000/image_nhzs2g.png)

6. Finally, don't forget to **"publish/**To update**"** your page so that the changes are sent to the published page.

![](https://storage.crisp.chat/users/helpdesk/website/-/a/6/a/b/a6ab90d8350d6000/image_iu67r7.png)

Did you like this article? If you need any help, reach out to our support team. We're always happy to help! :)  