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 2 of 2
  1. #1
    New to the CF scene
    Join Date
    May 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Creating basic data-driven combo boxes

    This is my first posting on this forum so please be gentle

    Here is the link to a page on my work web: -

    http://www.deltaclub.co.uk/businesslinkform.html

    You will see that I have three combo box objects on this form - one containing dates (Date) and the other two containing times (Time1 & Time2). Each time on each date is an available appointment.

    I would like the content of the date combos to be read from a file whenever the page is opened - a text file with one record per row would be fine (by way of an example - but this may be insufficient). On the face of it this would seem fairly rudimentary but I don't code in JavaScript of PHP and, having found this site I can make a start. I used to be a VB coder.

    On each date the following appointment times are available: -

    10:00
    11:00
    12:00
    14:00
    15:00

    This assumes that no appointments on a given day are taken.

    This leads me to conclude that each date should have records for each time - possibly as a CSV text file as follows: -

    "29th May 2009","10:00"
    "29th May 2009","11:00"
    "29th May 2009","12:00"
    "29th May 2009","14:00"
    "29th May 2009","15:00"
    "14th June 2009","10:00"
    "14th June 2009","11:00"
    "14th June 2009","12:00"
    "14th June 2009","14:00"
    "14th June 2009","15:00"

    The second time combo should make unavailable the time selected in the first time combo and present only those times available on the chosen date in the CSV file on the server.

    When I confirm appointments, at present I have to edit the page objects and update the web - which is quite messy and slow whereas uploading a simple text file, whilst an imperfect solution, is much better than what I currently have.

    I believe that a PHP or Javascript routine based on events on the three objects would remove the inherent problems and would provide a useful set of building blocks for other routines of a similar nature.

    The routine would trigger whenever the page is loaded (or refreshed) or the content of any one of the three objects gets or loses the focus or a selection is made in an object.

    The Date Combo would need to look up the available dates - keeping the currently selected date selected or, if that date is no longer available defaulting to the first date in the list. The user then makes a selection or makes no change to the selected date.

    The Time1 Combo then reads the available times for that date, retains the currently selected time (if available) or the first available time (if the selected is not available) and the user makes a selection or accepts the current selection.

    The Time2 Combo does the same as the Time1 Combo and in addition it eliminates the time selected in the Time1 Combo from the available choices.

    The result is that visitors are only offered available times on available dates (insofar as this solution provides).

    When the form is submitted I would receive the email and confirm the appointment with the client and, in addition, I would modify and upload the modified data file to the web server using Filezilla. The benefit is that there is a slim to none chance of two people wanting to book the same times on the same date at exactly the same time (though it is possible). In addition, I can add new dates and add new times if there is a demand and I can even add previously deleted times if there is sufficient demand to warrant bringing in a second consultant to take the meetings.

    I'm aware of the commercial solutions that are available but my boss won't pay for them and having a solution that could be adapted to bolt into any scenario (with suitable code modifications) would be a real asset.

    Any contribution would be most gratefully accepted.

    Thank you for reading this.
    __________________
    Kind regards,
    Martyn

    Required knowledge increases at a rate exponential to the rate at which knowledge may be acquired.

  • #2
    New to the CF scene
    Join Date
    May 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I'm replying to my original post because it received no response when originally posted. Whilst the dates have changed the query remains the same. The problem to be solved relates to any situation where there are categories and sub-categories using two or more combos.

    I would like to create the facility to define categories and sub-categories where both (or all) sets of data are individually read each time the page is refreshed. In its simplest form the data would be read from a text file (since it is much easier to modify and FTP a text file than it is to open the full web for editing and to republish the web - even incrementally).

    If anyone has had occasion to deal with this scenario (in any form) then I will be obliged if you can point me in the right direction.

    I have read numerous posts where the combo options are included in the page source but, thus far, none where the page code reads the combo content from an external file.

    I believe that I'm correct in thinking that the page source can reference a server-side JavaScript file (a text file by another name). Can anyone guide me as to how to accomplish this so that it populates the combo boxes and where the JavaScript then chooses the appropriate sub-categories once the main category is selected? I presume that the sub-category combo will be disabled by default and only enabled once a main category has been selected. I believe that a modular solution would offer enormous power to developers in this form and there would be merit in considering a solution that could be fully data driven (unless that would require PHP/MySQL).

    Thank you in anticipation.


  •  

    Posting Permissions

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