|SOLVED| If user input is filled another input is required

You can do something like:

$w.onReady(() => {
$w('#firstName2').onInput(event => {
$w('#lastName2').required = !!$w('#firstName2').value;//if there's a value that is defined and is not an empty string, it'll set the other field to be required.
})
})