Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Jun 2008
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Greying out input fields based on a date

    Hi all

    I am new to this so apologies for the basic question. I posted it in the ASP forum and was told to come here. I have an ASP page where users can enter hours that they have worked. There is a start date of their job and an end date. I need to be able to grey out fields that fall outside the date range so for example, if they start on the Weds they cannot enter hours for the Mon or Tue. Would anyone be able to give me an idea on how I put together a function to do this please?

    Many thanks

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,992
    Thanks
    203
    Thanked 2,536 Times in 2,514 Posts
    Too vague, I am afraid.

    Please post the relevant code, that is the part with the text boxes for data entry. Plus any other existing validation of the entered dates.

  • #3
    New to the CF scene
    Join Date
    Jun 2008
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I dont have the code as I dont know how to write it..

    Assuming I have
    box 1 MonStart
    box 2 MonLunch
    box 3 MonFinish
    box 4 MonTotal

    box 1-3 are all input fields, box 4 is disabled.

    I have an assignment start date which is already known and the validation is essentially;
    MondayCheck = Weekending (the weekending Sunday date) - 6
    If AssgtStart (assignment start - already pulled from a database) is less than MondayCheck then make Box 1-3 disabled as well..

    Thats it in laymans terms i'm afraid... i just need the principle behind how i do that.

  • #4
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,992
    Thanks
    203
    Thanked 2,536 Times in 2,514 Posts
    I think that this is a bit too big to be dealt with in this forum. The code for what you want plus the necessary validations is quite considerable. It looks as though it is a commercial application, and this forum is not a free coding service. We will happily help you with the code, but not write it all for you.

    I suggest you ask a mod to move this post to Web Projects, i.e. paid assignments.

    One way would be to have a set of radio buttons at the outset when your user can select Mon/Tue/Wed/Thur/Fri as the starting date. Then simply disable the textboxes relating to previous days as appropriate:-

    e.g.

    if (document.myform.rad1([1].checked) { // Tuesday
    document.myform.boxMonStart.disabled;
    document.myform.boxMonFinish.disabled;

    etc.
    Last edited by Philip M; 06-19-2008 at 12:24 PM.

  • #5
    New to the CF scene
    Join Date
    Jun 2008
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I didnt want you to write the whole thing for me, just give me a concept of how a function would be put together for something like this.

    No worries, thanks anyway for the suggestion, i'll put it into practice and see how it works!

  • #6
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,992
    Thanks
    203
    Thanked 2,536 Times in 2,514 Posts
    On second thoughts, it would be best to start with all the text boxes disabled.
    Then a set of radio buttons to select the start day.
    Then enable all boxes applicable to that start day or afterwards.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •