Posting variables
Hi, i am used to programming standalone computer applications not internet applications and would really appreciate some advice. I have a form with quite a few fields (text boxes etc...) on it. For additiional HCI, when the user edits the form from pre-exsting data, i like to have the fields all green, then if they edit some of the fields they turn red, to show that the changed data needs to be saved. To lesson the load on the database interation, i would like to program it so that when the user clicks save changes, it only updates the database based on the fields that are red. This is quite simple in standalone computer apps as i just code it to look for the fields that are red, but of course with the internet apps i cant check this as when the user clicks submit the fields are gone. Can anyone give me some advice on how this can be done. I am a bit lost with this. Thanks ~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:254079 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Posting variables
The red and green aspect would probably be faciliated by client side scripting like Javascript to change the colors of the data fields as they are modified. OnChange event should handle those just fine. Are you opposed to querying the database for a complete recordset? What I mean by this, you can load the record in action page and then compare against the variables in the form scope. Once you compare the fields that have changes, you can create a structure to store the names of the column and the data to be updated. After you create the structure, loop over the structure inside of cfquery statement with the column names in insert into tableName () area and the values in the values() area. Does that make sense? Teddy On 9/25/06, Richard White [EMAIL PROTECTED] wrote: Hi, i am used to programming standalone computer applications not internet applications and would really appreciate some advice. I have a form with quite a few fields (text boxes etc...) on it. For additiional HCI, when the user edits the form from pre-exsting data, i like to have the fields all green, then if they edit some of the fields they turn red, to show that the changed data needs to be saved. To lesson the load on the database interation, i would like to program it so that when the user clicks save changes, it only updates the database based on the fields that are red. This is quite simple in standalone computer apps as i just code it to look for the fields that are red, but of course with the internet apps i cant check this as when the user clicks submit the fields are gone. Can anyone give me some advice on how this can be done. I am a bit lost with this. Thanks ~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:254084 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Posting variables
thanks for your reply teddy. This does make perfect sense. The only reason i am a little opposed to opening the record is that i have been told that database interactions is what determines howmany concurrent users you can have on your server.Ther project i have at the moment has to be designed with the greatest optimisation as there will will be a large number of concurrent users on it. I am not sure if this is the case with concurrent users though. But this was my thinking behind checking to see which fields were red and only opening the database to save that data. Thanks ~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:254091 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: Posting variables
I've done something like that. My method was to have a hidden form field with the original data and compare it to the submitted data. input type=text name=userName value=#variables.userName# input type=hidden name=userName_orig value=#variables.userName# !--- Action page --- cfif form.userName neq form.userName_orig !--- Add username to data to update --- ... /cfif Of course, I'd loop on form.fieldnames (or a custom list of field names to check) so I wouldn't have to repeat the same code for every field. Another option might be to use JavaScript to disable the unchanged fields. Disabled fields aren't in the FORM scope of the action page. -Original Message- From: Richard White Sent: Monday, September 25, 2006 1:54 PM To: CF-Talk Subject: Posting variables Hi, i am used to programming standalone computer applications not internet applications and would really appreciate some advice. I have a form with quite a few fields (text boxes etc...) on it. For additiional HCI, when the user edits the form from pre-exsting data, i like to have the fields all green, then if they edit some of the fields they turn red, to show that the changed data needs to be saved. To lesson the load on the database interation, i would like to program it so that when the user clicks save changes, it only updates the database based on the fields that are red. This is quite simple in standalone computer apps as i just code it to look for the fields that are red, but of course with the internet apps i cant check this as when the user clicks submit the fields are gone. Can anyone give me some advice on how this can be done. I am a bit lost with this. Thanks ~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:254090 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Posting variables
Updating one column verses 10 or even 50 wont make much difference PLUS this is done on the DB server, so CF just passes this on (if it's on 2 different servers). You wont see a performance increase from updating only a few columns. If you wanted the colors thingy.. you could use a Confirm page.. have the update page post data to a confirm page Are you sure you want to overwrite these variables, or whatever. There you could actually check the form data against the DB data... But anyways, yeah if you wanted it on fly, you'd have to use JS or some client side language to change the colors. On 9/25/06, Teddy Payne [EMAIL PROTECTED] wrote: The red and green aspect would probably be faciliated by client side scripting like Javascript to change the colors of the data fields as they are modified. OnChange event should handle those just fine. Are you opposed to querying the database for a complete recordset? What I mean by this, you can load the record in action page and then compare against the variables in the form scope. Once you compare the fields that have changes, you can create a structure to store the names of the column and the data to be updated. After you create the structure, loop over the structure inside of cfquery statement with the column names in insert into tableName () area and the values in the values() area. Does that make sense? Teddy On 9/25/06, Richard White [EMAIL PROTECTED] wrote: Hi, i am used to programming standalone computer applications not internet applications and would really appreciate some advice. I have a form with quite a few fields (text boxes etc...) on it. For additiional HCI, when the user edits the form from pre-exsting data, i like to have the fields all green, then if they edit some of the fields they turn red, to show that the changed data needs to be saved. To lesson the load on the database interation, i would like to program it so that when the user clicks save changes, it only updates the database based on the fields that are red. This is quite simple in standalone computer apps as i just code it to look for the fields that are red, but of course with the internet apps i cant check this as when the user clicks submit the fields are gone. Can anyone give me some advice on how this can be done. I am a bit lost with this. Thanks ~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:254092 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Posting variables
I've done something like that. My method was to have a hidden form field with the original data and compare it to the submitted data. input type=text name=userName value=#variables.userName# input type=hidden name=userName_orig value=#variables.userName# !--- Action page --- cfif form.userName neq form.userName_orig !--- Add username to data to update --- ... /cfif Of course, I'd loop on form.fieldnames (or a custom list of field names to check) so I wouldn't have to repeat the same code for every field. Another option might be to use JavaScript to disable the unchanged fields. Disabled fields aren't in the FORM scope of the action page. Thanks for a reply. this makes perfect sense, thanks very much. its been bugging me for hours, thanks :) ~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:254095 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Posting variables
You can also double post the fields with original data. form.lastname_orriginal, form.lastname_new, then compare the values on your action page. This could then serve as the comparison operator for your javascript coloring. If the 2 values don't match, change background to red, if the user changes it back it goes green again, etc. The other option is to have your color function update a list that you store in a hidden form element. This list contains the fieldnames that have changed, then just loop over the list and update as needed. I don't like this as its extremely JS dependent, and your app breaks if JS is disabled. I'm not a big fan of this either sollution, but it accomplishes what your looking to do. Unless your updates span many tables, I don't feel your saving much database time by only updating 3 fields vs 30 fields, and your adding some effort in pre-processing now. I've not tested, but I bet the pre-processing in CF is more expensive than the additional fields in the insert. However, as I said before, the number of tables your updating would impact this significantly. Trey Rouse On 9/25/06, Teddy Payne [EMAIL PROTECTED] wrote: The red and green aspect would probably be faciliated by client side scripting like Javascript to change the colors of the data fields as they are modified. OnChange event should handle those just fine. Are you opposed to querying the database for a complete recordset? What I mean by this, you can load the record in action page and then compare against the variables in the form scope. Once you compare the fields that have changes, you can create a structure to store the names of the column and the data to be updated. After you create the structure, loop over the structure inside of cfquery statement with the column names in insert into tableName () area and the values in the values() area. Does that make sense? Teddy On 9/25/06, Richard White [EMAIL PROTECTED] wrote: Hi, i am used to programming standalone computer applications not internet applications and would really appreciate some advice. I have a form with quite a few fields (text boxes etc...) on it. For additiional HCI, when the user edits the form from pre-exsting data, i like to have the fields all green, then if they edit some of the fields they turn red, to show that the changed data needs to be saved. To lesson the load on the database interation, i would like to program it so that when the user clicks save changes, it only updates the database based on the fields that are red. This is quite simple in standalone computer apps as i just code it to look for the fields that are red, but of course with the internet apps i cant check this as when the user clicks submit the fields are gone. Can anyone give me some advice on how this can be done. I am a bit lost with this. Thanks ~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:254096 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Posting variables
Updating one column verses 10 or even 50 wont make much difference PLUS this is done on the DB server, so CF just passes this on (if it's on 2 different servers). You wont see a performance increase from updating only a few columns. If you wanted the colors thingy.. you could use a Confirm page.. have the update page post data to a confirm page Are you sure you want to overwrite these variables, or whatever. There you could actually check the form data against the DB data... But anyways, yeah if you wanted it on fly, you'd have to use JS or some client side language to change the colors. On 9/25/06, Teddy Payne [EMAIL PROTECTED] wrote: thanks greg, its a good point that it is only a few columns more on this occassion, later i will be getting into much more complex forms where there will be interactions with serveral tables in the database where i will need to use the hidden fields suggsted. Thanks for your reply ~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:254098 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Posting variables
very goodpoint about the js dependant, and the pre-processing, thanks ~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:254102 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4