HELP with PHP and javascript in a grid matrix

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Gleep

    HELP with PHP and javascript in a grid matrix

    Hello,
    I am trying to develop an online application that utilzes a grid to save our sales people weekly
    productivty.

    We have a grid listing the days of the week going across the top Sunday - Saturday
    Along the left side is hours of the day broken up in half hour increments. 16 total

    In the gridl, we want the cells to include an image that has three color states that are clickable.
    For example 1 click is green 2nd click is red - 3rd click is blue each color represents a dollar
    value.

    I wrote up a simple javascrip that rotates three images. I probably need a way to have an identifier
    on each image in each cell so when I submit the entire form I know what state the Image color was
    last.

    We want our sales people to click the various grid images to the correct colors by each half hour.
    Then once the week is coded I need to save the grid contents (probably a large array) into our
    database.

    Any ideas how I can started on this
  • Dan Stumpus

    #2
    Re: HELP with PHP and javascript in a grid matrix

    "Gleep" <Gleep@Gleep.co m> wrote
    [color=blue]
    > In the gridl, we want the cells to include an image that has three color
    > states that are clickable.
    > For example 1 click is green 2nd click is red - 3rd click is blue each
    > color represents a dollar value.[/color]
    [color=blue]
    > I wrote up a simple javascrip that rotates three images. I probably need a
    > way to have an identifier
    > on each image in each cell so when I submit the entire form I know what
    > state the Image color was last.[/color]
    ----------

    I'm not an expert, and the PHP princes may have a more elegant way, but I've
    done this kind of thing before. I'd:

    1. Create a separate hidden field for each cell which contains the
    color-state.
    2. when your onClick handler switches the color, have it
    set this.form.[hiddenFieldName ForTheCell].value to the color state value
    (e.g., 1,2,3 or whatever).

    When the form is submitted the values of the hidden fields will be sent up
    in $_POST with all the others.

    In the JSP world, you can return an array of values when a form with tabular
    data was submitted. That would be cleaner than a jillion hidden fields, but
    I don't know if that's possible in PHP.

    -- Dan




    Comment

    • Geoff Berrow

      #3
      Re: HELP with PHP and javascript in a grid matrix

      I noticed that Message-ID: <769011prdcbpf7 0934vuc4h1kc8d5 jmg0q@4ax.com>
      from Gleep contained the following:
      [color=blue]
      >I wrote up a simple javascrip that rotates three images. I probably need a way to have an identifier
      >on each image in each cell so when I submit the entire form I know what state the Image color was
      >last.[/color]
      You have kind of just re-invented the radio button...
      --
      Geoff Berrow (put thecat out to email)
      It's only Usenet, no one dies.
      My opinions, not the committee's, mine.
      Simple RFDs http://www.ckdog.co.uk/rfdmaker/

      Comment

      • Dave Patton

        #4
        Re: HELP with PHP and javascript in a grid matrix

        Gleep <Gleep@Gleep.co m> wrote in
        news:769011prdc bpf70934vuc4h1k c8d5jmg0q@4ax.c om:
        [color=blue]
        > Hello,
        > I am trying to develop an online application that utilzes a grid to
        > save our sales people weekly productivty.
        >
        > We have a grid listing the days of the week going across the top
        > Sunday - Saturday Along the left side is hours of the day broken up in
        > half hour increments. 16 total
        >
        > In the gridl, we want the cells to include an image that has three
        > color states that are clickable. For example 1 click is green 2nd
        > click is red - 3rd click is blue each color represents a dollar
        > value.[/color]

        You need at least four states - the fourth for "no dollars",
        on vacation, sick, etc. Default all cells to "no dollars",
        use radio buttons, and use javascript to do client-side
        validation, such as confirming that they really didn't generate
        any sales on Tuesday afternoon(e.g. when they were sick).

        --
        Dave Patton
        Canadian Coordinator, Degree Confluence Project

        My website: http://members.shaw.ca/davepatton/

        Comment

        Working...