Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Using javascript inside a WOPopup



Can any one help me with a line of javascript to be executed when a WO 
PopUpButton is changed?

I am familiar with adding an extra binding to a popUpButton of the form:
onChange = "form.submit();"

In this case I want to do something different.  My application is 
recording payments on several currencies. I have a popUpButton to 
select a currency from a small array.  The next TextField displays the 
exchange rate.  Selecting a currency *copies* an exchange rate from the 
currency table into the payment's exchange rate field.  The individual 
payment's exchange rate can then be edited if required.  The idea being 
that the currency table is not going to be continually adjusted and 
will therefore only be approximately right.  Selecting a currency will 
insert that last known exchange rate from the currency table but the 
operator is free to adjust that figure for a specific item.  If the 
operator uses the popUp to select a different currency the rate should 
again be set to to a value from the currency table.

I need to set up the popUp Button so that it transfers its exchange 
rate value to the payment record only when the popUp is changed.  If 
the user edits the exchange rate directly, without touching to the 
popUpButton I want the user's textfield entry to take precedence and 
not be overridden by the popUp.

I think I can do this by binding a single line of javascript to the 
popUp.  something like
onchange = "form.rate.value = value"

where the last "value" is the attribute bound to the value binding of 
the popUp.

I know this is isn't quite right.  Can someone help me with the next 
step?

Here's what I have:

Form1: WoForm {}

PopUpBotton1 : WOPopUpButton {
	list = currencyArray;
	item = currencyItem;
	displayString = currencyItem.abbreviation;
	selection = payment.currency;
	value = currencyItem. fxRate;
	onChange = "form.rate.value = value";   <--  this line is not correct
}

TextField1: WOTextField {
	value = payment.fxRate;
	name = "rate";
}



Denis Stanton
email@hidden
Home:  +64 9 533 0391
mobile: +64 21 1433622
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.




Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.