I have a date picker element on my page with a black border. I want the boarder color to change to red if the user does not select a date. I'm using the code below but it's not working, anyone have a solution ?
if (($w('#datePicker').value) === "") { $w("#datePicker").style.borderColor = "rgba(255,0,0,0.5)"; }
@Mike Moynihan Unfortunately, you cannot access the style. But what you can do instead,is to place a red box ( Hidden on load ) behind it ( and make it a bit bigger than the date picker ). now you can use the same condition to show and hide the red box ( red border )
Hi Mike, To check if the user picked a value or not ( in a date picker ), the condition should be compared to null, so your code should look something like this :
if( $w("#datePicker").value == null) { // your code is here }
Hope this helps! Best, Mustafa