Return-Path: Delivered-To: apmail-cocoon-users-archive@www.apache.org Received: (qmail 23943 invoked from network); 15 Jun 2006 15:49:35 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 15 Jun 2006 15:49:35 -0000 Received: (qmail 86727 invoked by uid 500); 15 Jun 2006 15:49:29 -0000 Delivered-To: apmail-cocoon-users-archive@cocoon.apache.org Received: (qmail 86668 invoked by uid 500); 15 Jun 2006 15:49:28 -0000 Mailing-List: contact users-help@cocoon.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: users@cocoon.apache.org List-Id: Delivered-To: mailing list users@cocoon.apache.org Received: (qmail 86639 invoked by uid 99); 15 Jun 2006 15:49:28 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 15 Jun 2006 08:49:28 -0700 X-ASF-Spam-Status: No, hits=1.2 required=10.0 tests=RCVD_IN_SORBS_WEB X-Spam-Check-By: apache.org Received-SPF: neutral (asf.osuosl.org: local policy) Received: from [69.93.53.226] (HELO admin.mesanetworks.net) (69.93.53.226) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 15 Jun 2006 08:49:25 -0700 Received: from [65.175.0.109] (port=63908 helo=mail.lojjic.net) by admin.mesanetworks.net with esmtp (Exim 4.52) id 1FquD7-0001sA-6y for users@cocoon.apache.org; Thu, 15 Jun 2006 09:56:45 -0600 Received: from 209.108.197.61 (SquirrelMail authenticated user jj) by mail.lojjic.net with HTTP; Thu, 15 Jun 2006 10:08:24 -0600 (MDT) Message-ID: <64036.209.108.197.61.1150387704.squirrel@mail.lojjic.net> In-Reply-To: <8e42dc2f0606150640xdd06a5av7be41e275efe40aa@mail.gmail.com> References: <8e42dc2f0606150556s2d9acd52k8c51417a9a589ff2@mail.gmail.com> <8e42dc2f0606150640xdd06a5av7be41e275efe40aa@mail.gmail.com> Date: Thu, 15 Jun 2006 10:08:24 -0600 (MDT) Subject: Re: Javascript State & Continuation From: "Jason Johnston" To: users@cocoon.apache.org User-Agent: SquirrelMail/1.4.4 MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - admin.mesanetworks.net X-AntiAbuse: Original Domain - cocoon.apache.org X-AntiAbuse: Originator/Caller UID/GID - [0 0] / [47 12] X-AntiAbuse: Sender Address Domain - lojjic.net X-Source: X-Source-Args: X-Source-Dir: X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N > I have a form binding a XML File with some repeaters, and for a nicest UI, > I > used some javascript to toggle hidden/shown state for some controls. I > added > a insert-row control, but when I use it, the page reloads itself, and the > "javascript state" is not kept. So I have to switch again to show the part > of the form. > Is there a solution to keep the "javascript" on the continuation ? That's an interesting problem. Widget States are usually a good tool for controlling visibility of widgets/groups, but it sounds like you want to avoid hitting the server to show/hide a section. So somehow you have to find a way to get the state of your client-side DOM sent to the server when the insert-row button is clicked, so it can be maintained and sent back in the next response, and then have your client-side script use that response value to re-initialize the correct state. One way might be to create another field in your form that is rendered as a hidden field, and then have your client-side javascript change the hidden field's value when it toggles the hidden/shown state of your control(s). visible ... ... function toggleState() { //or whatever yours looks like... var myControl = ... var currentState = myControl.style.display; myControl.style.display = (currentState == "none" ? "" : "none"); document.getElementById("myControlVisibility").value = (currentState == "none" ? "visible" : "hidden"); } The last piece would be a window.onload handler (be careful because CForms adds its own) that reads the hidden field's value and hides myControl if its value is "hidden". I hope this makes some sense, it's all in my head but it seems like it should work. Alternatively, if you choose to use the CForms AJAX rendering, this whole issue goes away because the insert-row button would only reload the repeater, not the whole page, so the state of your DOM would remain. Hope that gives you a start, --Jason --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org For additional commands, e-mail: users-help@cocoon.apache.org