From: Robert Tupelo-S. <sc...@cn...> - 2009-04-28 16:01:44
|
Hello all! I'm trying to use an AjaxObserveField and an AjaxUpdateContainer to allow a user to turn on and off the edit- ability of some fields. This was working great when I just had <wo:textfield>s but when I put in a <wo:text>, it is set to null on going from disabled to not disabled. Here's a tiny working example of a component with this behavior: <html> <head><title>A title</title></head> <body> <wo:form> <p> <wo:AjaxObserveField updateContainerID="ucID"> Disabled? <wo:checkbox checked="$disabled"/><br/> </wo:AjaxObserveField> <wo:AjaxUpdateContainer id="ucID"> <wo:textfield value="$a" disabled="$disabled"/><br/> <wo:text value="$b" disabled="$disabled"/><br/> </wo:AjaxUpdateContainer> </p> <wo:submit action="$doNothingAction"/> </wo:form> </body> </html> package your.app.components; import com.webobjects.appserver.WOActionResults; import com.webobjects.appserver.WOContext; import er.extensions.components.ERXComponent; public class Main extends ERXComponent { public Main(WOContext context) { super(context); } public String a = "a"; public String b = "b"; public boolean disabled; public WOActionResults doNothingAction() { return null; } } The "b" disappears whenever the "disabled" checkbox is unchecked; the "a" remains. Any advice? Thanks, Robert |