Javascript - Verify number range in text box with an instructional word as default value (and more)
Thanks in advance for reading.
I need some scripting.
I have a Total Field and fields for Mon 1, Tue 1, Wed 1, Thur 1, Fri 1, Sat 1 and Sun 1.
The user will either:
1. Enter their scheduled hours where applicable across Mon 1 through Sun 1, with a possible range of 0-12 per day. In this instance, I need Mon 1-Sun 1 to each verify the range. But the default value of each field must remain "Mon" , "Tue" , "Wed", "Thu" , "Fri", "Sat" and "Sun", respectively, because I use On Focus and On Blur scripts (see below) to instruct the user. Additionally, if the user enters numbers (above 0) into any of the Mon 1-Sun 1 fields, I need Total Field to calculate the total and become uneditable.
2. The user can instead not fill in their schedule and instead only fill in their total hours in Total Field. The range for Total Field must be 1-35, where the default value is "Total".
I'm using these scripts on the fields to instruct the users:
//On Focus//
if (event.target.value==event.target.defaultValue) { event.target.value = ""; event.target.textColor = color.black; }
//On Blur//
if (event.target.value=="") { event.target.value = event.target.defaultValue; event.target.textColor = color.ltGray; }
Your help is much appreciated! (Also any best-practice suggestions are gratefully accepted.)