Connecting Tech Pros Worldwide Forums | Help | Site Map

HELP with PHP and javascript in a grid matrix

Gleep
Guest
 
Posts: n/a
#1: Jul 17 '05
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
Guest
 
Posts: n/a
#2: Jul 17 '05

re: HELP with PHP and javascript in a grid matrix


"Gleep" <Gleep@Gleep.com> 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.[hiddenFieldNameForTheCell].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




Geoff Berrow
Guest
 
Posts: n/a
#3: Jul 17 '05

re: HELP with PHP and javascript in a grid matrix


I noticed that Message-ID: <769011prdcbpf70934vuc4h1kc8d5jmg0q@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/
Dave Patton
Guest
 
Posts: n/a
#4: Jul 17 '05

re: HELP with PHP and javascript in a grid matrix


Gleep <Gleep@Gleep.com> wrote in
news:769011prdcbpf70934vuc4h1kc8d5jmg0q@4ax.com:
[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
http://www.confluence.org/
My website: http://members.shaw.ca/davepatton/
Closed Thread