Here you go. JS + Java. Let me know if you find something in, which can cause such behavior :)
============ JS ============ Tapestry.AjaxCheckbox = Class.create({ initialize: function(formId, clientId, selectAllMode, radioMode) { this.selectAllMode=selectAllMode; this.radioMode=radioMode; this.form = $(formId); this.element = $(clientId); //this.element.stopObserving("click",this.onClick); this.element.observe("click", this.onClick.bindAsEventListener(this)); }, createHidden : function() { var hidden = new Element("input", { "type":"hidden", "name": this.element.id + ":hidden", "value": this.element.id}); this.element.insert({after:hidden}); }, onClick : function(event) { Event.stop(event); if(this.radioMode=='true') { $$('input').each(function(e) { if(e.type=='checkbox') { e.checked=0; } }); //set self this.element.checked=1; } else if(this.selectAllMode=='true') { this.form.getInputs('checkbox').each(function(e) { e.checked=1; }); //clean self this.element.checked=0; } var onsubmit = this.form.onsubmit; if (onsubmit == undefined || onsubmit.call(window.document, event)) { this.createHidden(); this.form.submit(); } } }); Tapestry.Initializer.ajaxCheckbox = function(formId, clientId, selectAllMode, radioMode) { new Tapestry.AjaxCheckbox(formId, clientId, selectAllMode, radioMode); } =========================== ======= Java =========== @IncludeJavaScriptLibrary("ajaxcheckbox.js") public class AjaxCheckbox extends AbstractField { @Parameter(required = false, autoconnect = false) private boolean value; @Parameter(required = false) private boolean selectAllMode; @Parameter(required = false) private boolean radioMode; @Inject private RenderSupport renderSupport; @Environmental private FormSupport formSupport; @Inject private ComponentResources resources; @Environmental private ValidationTracker tracker; @Inject private Request request; @BeginRender void begin(MarkupWriter writer) { String asSubmitted = tracker.getInput(this); boolean checked = asSubmitted != null ? Boolean.parseBoolean(asSubmitted) : value; writer.element("input", "type", "checkbox", "name", getControlName(), "id", getClientId(), "checked", checked ? "checked" : null); resources.renderInformalParameters(writer); //decorateInsideField(); } @AfterRender void after(MarkupWriter writer) { writer.end(); // input renderSupport.addInit("ajaxCheckbox", formSupport.getClientId(), getClientId(), valueOf(selectAllMode), valueOf(radioMode)); } @Override protected void processSubmission(String elementName) { String postedValue = request.getParameter(elementName); // record as "true" or "false" tracker.recordInput(this, Boolean.toString(postedValue != null)); value = postedValue != null; } ======================= On Tue, Oct 19, 2010 at 9:25 PM, Thiago H. de Paula Figueiredo < thiag...@gmail.com> wrote: > On Tue, 19 Oct 2010 14:10:00 -0200, Dmitriy Vsekhvalnov < > dvsekhval...@gmail.com> wrote: > > Is it what AJAX stands for? :) >> > > Yes! :) > > > i was thinking that ajax is to do things in background, while letting user >> see something immediately. And i don't think checkbox falls to area where it >> should get response from server to display new state, isn't it? >> anyway you can try it yourself and see that it is CHANGED but then >> restored back when sending form data. >> > > Please post your JavaScript code. It doesn't seem related to Tapestry. > > -- > Thiago H. de Paula Figueiredo > Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, > and instructor > Owner, Ars Machina Tecnologia da Informação Ltda. > http://www.arsmachina.com.br > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > >