Maybe I should have stated I have tried something like this.  I have data
entry TextFields for: 

  SalePrice
  DiscountAmount

then add another for: 

  DiscountPercentage

When I enter an amount into DiscountAmount I need DiscountPercentage to get
calculated and update on the form.  And it should also work the other way
around - enter DiscountPercentage and DiscountAmount gets updated.  

But DiscountPercentage does not have a setter in my model - just a getter
(it's calculated for viewing only and does not get persisted anywhere).  So
I get errors when Wicket attempts to update the model.

And if I enter an an amount in DiscountPercentage and attempt to update the
value for DiscountAmount then I can't update this either since I don't want
to persist the form until all the other fields are entered. 

I am using the same form for creating a new record and editing an existing
one, so when doing a new record I don't have mandatory fields filled when
I'm entering the Discount stuff.


Steve 







steve222 wrote:
> 
> Hi.  Hopefully I can explain this scenario OK - I'll try to keep it
> simple.
> 
> On a form, I have a couple of TextFields - SalePrice and DiscountAmount.  
> 
> After the user enters SalePrice, I need a way to allow the user to enter
> the DiscountAmount as either a flat rate or as a percentage of the
> SalePrice.
> 
> For example, if entered SalePrice is 1000, the user could enter a flat
> DiscountAmount of 200.00.  Or they could enter 20%.  I'd like the option
> to do either since SalePrice might be 8,745 and the discount 2.75% or
> something (so hard to just calculat the true cash amount).  Or it might
> just really be a flat £200 in which case hard to calculate the %.
> 
> In a traditional app where I'm writing the JavaScript, I can think of
> various ways to do this involving extra fields for flatrate and/or % -
> then updating the real DiscountAmount field when the "dummy" fields
> change.
> 
> But I'm trying to work out an elegant way with Wicket/AJAX - without too
> much success so far.  
> 
> Any suggestions - or links to similar examples?  Ideally, the fewer extra
> dummy fields the better.
> 
> Thanks. 
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Wicket-AJAX-update-form-TextField-value-from-another-field-tp20117258p20119555.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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

Reply via email to