Ken,
Additional to Mike's comments, check out AjaxObserveField. There is
an example of dependent popups in their. I use Ajax EVERYWHERE and it
is great. I made a little component for each of the different field
types like this:
<webobject name="Popup"/>
<webobject name = "ScriptUpdateContainer">
<webobject name = "UpdateScript"/>
</webobject>
<webobject name = "ObserveField"></webobject>
ScriptUpdateContainer: AjaxUpdateContainer {
id = scriptUpdateID;
}
UpdateScript: WOString {
escapeHTML = false;
value = "";
}
Popup: WOPopUpButton {
displayString = ^displayString;
item = ^item;
list = list;
selection = selection;
noSelectionString = noSelectionString;
id = id;
}
ObserveField: AjaxObserveField {
observeFieldID = id;
fullSubmit = true;
action = ^action;
updateContainerID = scriptUpdateID;
onSuccess = highlightScript;
}
public class AjaxPopupButton extends WOComponent {
public AjaxPopupButton(WOContext context) {
super(context);
}
@Override
public void pushValuesToParent() {
setValueForBinding(selection, "selection");
}
private String id;
public void setId(String val){
if (id == null) id = val;
}
public String id(){
if (id == null) id = "apopup_" + String.valueOf(hashCode());
return id;
}
public Object selection;
public String displayString;
public Object item;
public NSArray list;
public String noSelectionString;
public WOComponent action;
public String scriptUpdateID(){
return id() + "_value_script";
}
/**
* Bind a string of JScript statements to this to include in the
onSuccess function for the text field
* (i.e. "alert('valueChanged');"
*/
public String otherUpdateScript;
public String highlightScript(){
return "function(){new Effect.Highlight($('" + id() + "'));" +
otherUpdateScript + "}";
}
}
A couple of cool things about this is that the bindings are the same
as for WOPopUp so you can just change your WOD file component name.
The other is that I have the Effect in there so that it highlights
when you change it. You can also include an update script to update
another popup update container if you want.
John
On Feb 26, 2008, at 9:18 AM, Ken Anderson wrote:
Everyone,
I have a 5.3 app using stable WOLips that has hundreds of components
and does not currently use Wonder. I have a few sub-components that
have multiple dependent pop-ups, and I do a submit(); onChange on
those pop-ups to refresh the page.
Unfortunately, the pages have gotten pretty big, and the constant
refresh is getting tedious. I was wondering if anyone has a road-
map where I can use a tiny bit of Ajax in a single sub-component to
improve the user experience (it's a maintenance app...so User==Me).
I don't have a ton of time, and can't really risk moving to 5.4 or
reworking the entire app.
Any thoughts?
Thanks,
Ken
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/the_larsons%40mac.com
This email sent to [EMAIL PROTECTED]
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com
This email sent to [EMAIL PROTECTED]