How to use velo coding to create a password field that is able to show a lightbox?

I’d like to implement a password + confirmation button. When the button is pressed and the password is correct, I want a lightbox to appear.

I’ve already (kinda) tried this one: How to: Password Box + Answer Validation
For tying this code out, I changed /nextPagePath to a youtube link, but it didn’t work. Next, I changed the last line to:
if($w(“#input1”).valid) {$w(‘#box1’).hide}
Box1 was just there to see, if anything happens. But it didn’t.

How can I make this work?

Hi, user3292 !!

It seems like you want to implement a function to validate passwords. Implementing this feature (validating passwords and displaying a lightbox) should be relatively easy once you understand the basics. However, there is something more important to consider when implementing this functionality. You must not hard-code (directly write) the answer password into the frontend code. The frontend code is visible to users, so the answer password must be placed in the backend code. Ideally, the password should be stored in a secret, and in the backend code, you should retrieve the answer from the secret to perform the password validation.

To implement this feature, you will need to create a web.js file (or .jsw, although this is not recommended) that can return the result of the backend process to the frontend. While such a level of security may not be necessary for your current functionality, please be careful when creating systems that handle more important passwords. :wink:

And now to the main point, while it was correct to change “/nextPagePath” to a YouTube link, this is the way to define links for internal transitions within your site. It is not the correct way to set up external links. You may have made a mistake in how you wrote the link to YouTube, so please refer to the following article and try rewriting it.

Also, for the code added to check the functionality, please change $w('#box1').hide to $w('#box1').hide(); .