Is it possible to highlight user input if no value is entered?

Hi team,

Is this possible? For example, if someone doesn’t enter a name in a user input then tries to continue to the next page can that particular input be highlighted?

I thought that

$w('#datePicker').required;

should have been a simple solution, but no dice.

I have the input set to ‘required’ under settings. I can’t seem to find any posts or info on this topic.

On the same note is it possible to highlight the input in green if it meets requirements?

Thanks in advance!

 $w("#datePicker").required = true;

and yes, it is possible to highlight in green, but for that you;ll have to write code:
in the onChange() function:

let input1 = $w("#input1");
input1.valid ? input1.style.borderColor =  "green" : input1.style.borderColor = "black";

@J.D. I had stopped using this forum as I always received answers days/weeks later with check this document, you my friend are an absolute legend!

It’s rare that I find post that are straight to the point and provide an answer to anyone else trying to find the same solution. I’m not an expert like most on here but a simple bit of direction shows me what I can do to play with the rest of my coding experience. Your help yesterday ended up in me being able to code some more complex areas to minimise element usage and it helped me learn some new areas just by giving me a few simple lines of code, then it has a penny drop moment of AH! that’s why it wouldn’t work.

can’t thank you enough! :slight_smile:

Stephen

@stephenmccall you’re welcome. glad to help :slight_smile: