Set a condition to display an error message when a user mouses over a disabled input field?

Brendan Walther shared this question 11 months ago
Answered

I have a form with a variety of input fields.

I have a use case where I have an input field disabled until a value is entered in another input field.

I'm wondering if it is possible to create a mouse over event that will display an error message when the input field is disabled? I can't seem to find any condition that will let me identify whether or not the field is editable or not.


I have it working with the use of a variable, but curious if there is a better method available using the event/condition functionality?


Thanks

Best Answer
photo

Two ways come to mind. The first way, using the "on Mouse Over" event on the input field, you could test the value of the other input field that requires a value and if it is blank you display the error message. The second way could be to have a variable that tracks the enabled/disabled state of the input field. Then, once again using the the "on Mouse Over" event on the input field, you check the value of the variable and, if it indicates the field is disable, you display the error message.

As a side note, you may also want to change of the style of the input field between when it is enabled and when it is disabled. Giving at a grayed-out appearance when it is disabled can work in tandem with your error message.

Hope this helps. Cheers!

Comments (1)

photo
2

Two ways come to mind. The first way, using the "on Mouse Over" event on the input field, you could test the value of the other input field that requires a value and if it is blank you display the error message. The second way could be to have a variable that tracks the enabled/disabled state of the input field. Then, once again using the the "on Mouse Over" event on the input field, you check the value of the variable and, if it indicates the field is disable, you display the error message.

As a side note, you may also want to change of the style of the input field between when it is enabled and when it is disabled. Giving at a grayed-out appearance when it is disabled can work in tandem with your error message.

Hope this helps. Cheers!