I have a web form in which users input the hours a restaurant is open, as well as hours they serve breakfast, lunch, happy hour, etc. The open and close times for each are selected using a dropdown menu. The first two dropdowns indicate the open and close time overall for the restaurant. I want to set the form up so that if the user selects \"Closed\" in the first dropdown, it disables all the other dropdowns -- this is to help prevent errors such as having hours for when the restaurant serves breakfast on a day it's closed!
I've done this successfully on search and report pages, but the code didn't work here. I tried something similar to what was outlined in the post above, but that's not working either. Here's my code:
function hideFields()
{
var mainSelect = \"Closed\";
if (document.getElementById(\"InsertRecorddineHours_open\").value == mainSelect)
{
document.getElementById(\"InsertRecorddineHours_closed\").disabled = true;
}
else
{
document.getElementById(\"InsertRecorddineHours_closed\").disabled = false;
}
}
onload = hideFields;
document.getElementById(\"InsertRecorddineHours_open\").onchange = hideFields;
You can post now and register later.
If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.
Question
mdupras
I'm having trouble getting something similar to this function to work:
http://forums.caspio.com/viewtopic.php?t=3647&sid=6f47d64070f6b402cb5e40a5e6df5453
I have a web form in which users input the hours a restaurant is open, as well as hours they serve breakfast, lunch, happy hour, etc. The open and close times for each are selected using a dropdown menu. The first two dropdowns indicate the open and close time overall for the restaurant. I want to set the form up so that if the user selects \"Closed\" in the first dropdown, it disables all the other dropdowns -- this is to help prevent errors such as having hours for when the restaurant serves breakfast on a day it's closed!
I've done this successfully on search and report pages, but the code didn't work here. I tried something similar to what was outlined in the post above, but that's not working either. Here's my code:
Any thoughts on this? Thanks!
-- Mike
Link to comment
Share on other sites
5 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.