If you want to go client side, you could pass a list of fields that were modified by 
the user from the browser, as opposed to passing all the original values which you 
should already know.  Easy enough to put an onChange event handler into a field and it 
this field to list of changed fields, but what if they change it back?  Well, you can 
store the original values in an array and then onSubmit do the comparisons, set up the 
hidden changedFields input and bingo, a cheap hack  ... ahem a solution to the problem.

I'm still partial to making the comparisons at the web tier.  It's cleaner and easier 
to maintain.  Plus a little reflection magicks could go a long way towards creating 
the:

public static List gimmeDifferent(Object dao, Object form) throws 
BiffDontConMeException

method.

-Dave


> -----Original Message-----
> From: Robert S. Sfeir [mailto:[EMAIL PROTECTED]]
> Sent: Monday, February 10, 2003 3:12 PM
> To: Struts Users Mailing List
> Subject: Re: General Question
> 
> 
> 
> Well first you might find that updating all the fields is easier, but 
> still if you want to do it your way, you have to have something to 
> compare the old value to the new one, and in that case you 
> use a hidden 
> field.  So you'd have something like:
> 
> <input type="text" name="field1">
> <input type="hidden" name="oldField1">
> 
> When the user hits submit you'll have to check to see if the 
> values are 
> the same, if they are ignore and don't update otherwise update.
> 
> You see you have to loop over all the fields anyway, it's a 
> form submit 
> thing, you can't tell it to submit a form partially.
> 
> R
> 
> On Monday, Feb 10, 2003, at 15:46 US/Eastern, Vinay Chandupatla wrote:
> 
> > That is exactly what I am trying to avoid. That is a  the 
> real pain I 
> > don't want to update all the fields , I just want to update that 
> > particular value based upon it's key. In this case the database in 
> > question is the a server socket connection which cannot 
> take lengthy 
> > query strings( i was just exemplifying with a normal 
> database, ), and 
> > I thought it is not efficient overriding the values which 
> need not be 
> > overridden.
> >
> > Infact I was thinking in the lines of what dave has 
> suggested but even 
> > that will still have a lot of comparisions. Has anybody encountered 
> > these kind of situations with user editing lot of transactions and 
> > posting them back to database. If so how did you deal with them
> >
> > Thanks Dave and Guptill for your replies,
> >
> > Vinay
> >
> >
> > ---------- Original Message ----------------------------------
> > From: "Guptill, Josh" <[EMAIL PROTECTED]>
> > Reply-To: "Struts Users Mailing List" 
> <[EMAIL PROTECTED]>
> > Date: Mon, 10 Feb 2003 15:42:14 -0500
> >
> >> No, just update your database table with all the fields that come 
> >> back on
> >> the form.  If a field has changed, that value will be updated.  
> >> Otherwise,
> >> the same value will be written to the table and you will 
> be no worse 
> >> off.
> >>
> >> Unless this is exactly what you are trying to avoid?
> >>
> >> -----Original Message-----
> >> From: Vinay [mailto:[EMAIL PROTECTED]]
> >> Sent: Monday, February 10, 2003 3:27 PM
> >> To: Struts Users Mailing List
> >> Subject: General Question
> >>
> >>
> >> This is a very general question and not specifically related to 
> >> struts or
> >> tag libraries, may be naive,thought somebody could help me off the 
> >> list on
> >> the list.
> >>
> >> I have this very big form with list of 100's of 
> transactions pulled 
> >> from the
> >> database base thru a select statement or a similar one.
> >>
> >> And this form has a lot of textfields where the user can edit the 
> >> fields and
> >> send it back to the database for updations.
> >>
> >> I need to get only those values which are being edited by 
> the user for
> >> updations in Action Class. If this looks vague , i can elaborate.
> >>
> >> Do i have to compare or check if user has edited.
> >>
> >> The solution might be very trivial , but couldn't get any idea.
> >>
> >> Thank you ,
> >>
> >> Help appreciated,
> >>
> >>
> >> Vinay.
> >>
> >>
> >>
> >>
> >>
> >>
> >> 
> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >> For additional commands, e-mail: 
> [EMAIL PROTECTED]
> >>
> >>
> >
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> R
> 
> --
> Robert S. Sfeir
> Senior Java Engineer
> National Institutes of Health
> Center for Information Technology
> Department of Enterprise Custom Applications
> [EMAIL PROTECTED]
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to