PDA

View Full Version : Flagging Form Fields as "Updated" When Edited by User


jahmekyat
03-22-2006, 07:18 PM
Hi,
I am trying to come up with a way to flag form fields that have been updated by users of our website. Our users create job orders that are displayed on our website. The form that displays the Job Order details has about 30-40 fields that are displayed. The users have the ability to go back and edit their Job Order details once they have posted the original Job Order Details.
The edit sub routine displays the new form with all the original details for them to change. When they submit the changes, the MySQL database is updated and the new information is displayed in the project details form. What I would like to do is to change the color of the fields that have been changed, or put a small "Updated" image next to the fields that have been updated to let other users know what has been changed.
I'm trying to come up with ideas and would like some help from anyone that has done this before or that has a good idea of how to get it done.
Thanks in advance for any help with this issue,

jah

mlseim
03-22-2006, 09:54 PM
You didn't say if you were using PHP or Perl to display the form with
the changes....

Here's what I thought of ....

When you display the form with changes, have the script
dynamically add a style line to each item, where you
specify the background color to be "green" if it has
changed ... example, the phone number has changed.

<form action='blahblah' method='post'>
<input type='text' style='background-color: #ffffff;' name='name' value='Bill Smith'><br />
<input type='text' style='background-color: #ff00ff;' name='phone' value='555-1234'><br />
<input type='text' style='background-color: #ffffff;' name='email' value='bill@aol.com'><br />
</form>

jahmekyat
03-22-2006, 10:17 PM
Hi Msleim,
That is what I am thinking as well. I am using CGI(PERL) for our website. I just can't really come up with a way to determine which fields have been changed so they can be flagged. Any ideas on that? I am kind of thinking that I will have to store the fact that the value has been updated so I can recall it later to determine if I should change the color of the field to show that it has changed. Does that make sense?

mlseim
03-23-2006, 12:30 AM
So they initially fill out the form and later recall it to make changes?
Maybe several days later?

I guess you have to also determine if they change it several times?

What's considered a change ... only the first time it gets changed?

Reading your first post, I'm thinking that you could have a duplicate
set of MySQL table values for all 30 items. The original, and then
a second table. It always pushes the values in one table to the
second table each time it gets updated ... then, you can compare
both tables. So the "changed" indication happens each time, as
the table is updated.

I guess it would consume more space in your database, but the
added advantage would be to restore (or undue) the last change
with a click of the button. You could even use a 3rd table for a
default, or original copy of the first form created ... ... simply by reversing the tables ... copying one table back into the other.


I'm not a MySQL expert, but there is that portion of this forum you
could use for questions about table duplication, compares, etc.

I would probably lean more toward a duplicate table instead of a
flag ... because of the "undo" feature you could have.

jahmekyat
03-23-2006, 03:21 PM
Hi Mlseim,
Thanks again for your help. I was hoping that I could come up with a way to do this without having to create another table in the DB. The more we get into the issue, the more that it's looking like I might have to do it that way. From what you've mentioned, it would work with the way we have the back end set up.

I just wish that I could just flag the job order itself when they edit it instead of flagging each field. That way, I could just put a nice "Updated" image next to the job order when they click submit on the edit page.

I was kind of hoping that I would get a bigger response with more ideas about this issue. I'm kind of, "Under the Gun", so to speak, to get this done and need to get to work on it today. I guess I will wait a little more to see if it gets any more posts.

Thanks again for your help!

jah

mlseim
03-23-2006, 08:26 PM
The "flag" idea is good ... but what if I go in four times and change a
different text box each time? How would you know which change took place
at which time? You can see how this could get sort of messy.

With my idea ... you could have a "this is your change, and this is what
you previously had" ... "save your changes?, or undo it". That sort of thing.