# Question about "secure code - 4" Weweb element

**URL:** <https://community.weweb.io/t/question-about-secure-code-4-weweb-element/3676>\
**Category:** How do I?\
**Created:** [July 26, 2023, 9:07am UTC](https://community.weweb.io/t/question-about-secure-code-4-weweb-element/3676 "2023-07-26T09:07:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![raelyn](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/raelyn/32/2803_2.png) [@raelyn](https://community.weweb.io/u/raelyn)\
**Post date:** [July 26, 2023, 9:07am UTC](https://community.weweb.io/t/question-about-secure-code-4-weweb-element/3676/1 "2023-07-26T09:07:47Z")

</div>

![image](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/7/7d417a7083ac5a811f5e00317ea0782f8b26c63a.png)

Hello there, I have a 4-digit secure code that users need to enter to verify their email.

When I use the “secure code” element in Weweb and attempt to type in the second digit, it does not populate into the second box and so on (like it how it would normally be). I have to click on the second box, enter the second digit, click on the third box, enter the third digit, and so on.

How do I get this to happen, where if I type the second digit, it goes to the second box directly, and so on?

---

<div class="post-metadata">

**Author:** ![raelyn](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/raelyn/32/2803_2.png) [@raelyn](https://community.weweb.io/u/raelyn)\
**Post date:** [July 28, 2023, 7:04am UTC](https://community.weweb.io/t/question-about-secure-code-4-weweb-element/3676/2 "2023-07-28T07:04:26Z")

</div>

UPDATE: Managed to come up with something with Copilot AI 🙂

---

<div class="post-metadata">

**Author:** ![Alexis](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/alexis/32/13248_2.png) [@Alexis](https://community.weweb.io/u/Alexis)\
**Post date:** [July 28, 2023, 2:21pm UTC](https://community.weweb.io/t/question-about-secure-code-4-weweb-element/3676/3 "2023-07-28T14:21:13Z")

</div>

Well done, would you mind sharing it with everyone ?

We will release very soon a new action allowing people to focus input programmatically. So you will be able to attach a workflow on change on the code element and target the next input at every change I guess

---

<div class="post-metadata">

**Author:** ![raelyn](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/raelyn/32/2803_2.png) [@raelyn](https://community.weweb.io/u/raelyn)\
**Post date:** [July 29, 2023, 3:45am UTC](https://community.weweb.io/t/question-about-secure-code-4-weweb-element/3676/4 "2023-07-29T03:45:31Z")

</div>

Sure! The code I use was (this is for on change workflow on the first box), replace with your own variable values. Then do something very similar to the second and third box~

// Access the global variables  
let code1Value = variables[‘’];  
let code2Value = variables[‘’];  
let code3Value = variables[‘’];  
let code4Value = variables[‘’];

// Check if the length of code1Value is more than 1  
if (code1Value.length \> 1) {  
// If it is, add the second character to code2Value  
code2Value += code1Value[1];  
// And remove it from code1Value  
code1Value = code1Value[0];  
}

// Check if the length of code2Value is more than 1  
if (code2Value.length \> 1) {  
// If it is, add the second character to code3Value  
code3Value += code2Value[1];  
// And remove it from code2Value  
code2Value = code2Value[0];  
}

// Check if the length of code3Value is more than 1  
if (code3Value.length \> 1) {  
// If it is, add the second character to code4Value  
code4Value += code3Value[1];  
// And remove it from code3Value  
code3Value = code3Value[0];  
}

// Update the global variables  
variables[‘’] = code1Value;  
variables[‘’] = code2Value;  
variables[‘’] = code3Value;  
variables[‘’] = code4Value;

// Return the updated global variables  
return {  
code1Value: variables[‘’],  
code2Value: variables[‘’],  
code3Value: variables[‘’],  
code4Value: variables[‘’]  
};
