AutomaApp / automa

A browser extension for automating your browser by connecting blocks
https://www.automa.site
Other
11.41k stars 1.23k forks source link

Automa CEB: Toggle text field visibility based on a condition #1628

Closed Vader16039 closed 7 months ago

Vader16039 commented 8 months ago

I want to toggle the text field visibilty based upon a password input. Can someone kindly help me here.

Before typing the password and clicking unlock. image

After typing the password and clicking unlock. image

Kholid060 commented 7 months ago

You can do that like this:

First, set the hidden value of all Input components you want to toggle to true in the layout section when you edit the component. image

After that, in the "UNLOCK" button. Add the "click" event and paste the below code:

image

const PASSWORD = 'YOUR_PASSWORD_HERE';

const PASSWORD_INPUT_COMP_ID = 'input6';
const COMP_IDS = ['input3', 'input2', 'input4'];

const inputPass = $vars.comps[PASSWORD_INPUT_COMP_ID].value.trim();

COMP_IDS.forEach((compId) => {
  $helper.setCompData(compId, { hidden: inputPass !== PASSWORD });
})

There are several things you need to replace in the above code:

Vader16039 commented 7 months ago

Thanks @Kholid060 . This is works.