Return-Path: Delivered-To: apmail-cocoon-users-archive@www.apache.org Received: (qmail 61557 invoked from network); 7 Oct 2005 12:52:55 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 7 Oct 2005 12:52:55 -0000 Received: (qmail 72214 invoked by uid 500); 7 Oct 2005 12:52:48 -0000 Delivered-To: apmail-cocoon-users-archive@cocoon.apache.org Received: (qmail 72170 invoked by uid 500); 7 Oct 2005 12:52:48 -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 72156 invoked by uid 99); 7 Oct 2005 12:52:48 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 07 Oct 2005 05:52:48 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=RCVD_BY_IP,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of antonio.fiol@gmail.com designates 64.233.184.204 as permitted sender) Received: from [64.233.184.204] (HELO wproxy.gmail.com) (64.233.184.204) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 07 Oct 2005 05:52:51 -0700 Received: by wproxy.gmail.com with SMTP id 69so312134wri for ; Fri, 07 Oct 2005 05:52:25 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=pjmGaL0s8OPGqklP8nV1Cdo/TOTqH7oMybNefoe4lR7Ks6bNPb2CLZCuca3zWo39HiHnABDeAp7HuFvu9gDl/GxF8PGBs868xZ5wXuG3LSdD7tZt5ZzrRDsyJ+OWykk/Qs1qVyaDMWPzR2sSXEBs0el+WHOOzaAb7+93c+7RTJ4= Received: by 10.54.108.2 with SMTP id g2mr1424711wrc; Fri, 07 Oct 2005 05:52:25 -0700 (PDT) Received: by 10.54.89.5 with HTTP; Fri, 7 Oct 2005 05:52:25 -0700 (PDT) Message-ID: Date: Fri, 7 Oct 2005 14:52:25 +0200 From: =?ISO-8859-1?Q?Antonio_Fiol_Bonn=EDn?= Reply-To: =?ISO-8859-1?Q?Antonio_Fiol_Bonn=EDn?= To: users@cocoon.apache.org Subject: Re: flow problem with reload button In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <4342AF4A.9070708@apache.org> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N I have not found a solution for this problem yet. Could anyone please help me a step further? Thanks in advance. -- Antonio 2005/10/5, Antonio Fiol Bonn=EDn : > Hello, > > Thank you for replying. > > I'm using POST. > > The template for A is: > ... > action=3D"#{$continuation/id}.continue" method=3D"POST"> >
> > > bold;"/> > ... > > The template for B (if that matters): > ... > action=3D"#{$continuation/id}.continue" method=3D"POST"> >

>

> ... > > I am not using any parameters on the URL query string. > > > > 2005/10/4, Sylvain Wallez : > > Antonio Fiol Bonn=EDn wrote: > > > > > Hello, > > > > > > I am having strange problems (described below) when hitting the > > > "reload" button on my browser when displaying form B in scenario > > > described below. Could anyone please help me understand why? > > > > > > I am using a 2-form approach to editing an XML file, one for a first > > > level view and a deeper detail editing view. > > > > > > Form "A" only contains a repeater with a "nombre" widget for each row= , > > > plus all the necessary widgets for deleting selected rows. > > > It also has a submit called "nuevo" (=3DAdd new, see below for js cod= e > > > managing it), a standard HTML submit button, and an edit submit butto= n > > > on each row. > > > > > > Example: > > > [Delete selected] [Add new] [Save changes] > > > [X] [Edit] Name1 > > > [X] [Edit] Name2 > > > [X] [Edit] Name3 > > > [X] [Edit] Name4 > > > > > > Form "B" is bound to the same XML file, but with more fields and > > > attributes mapped to form widgets, but it only maps a certain part of > > > the XML. > > > > > > Example: > > > Name: [Name1] > > > E-mail: [a@b.c ] > > > [Save changes] > > > > > > So the binding for B is dynamically generated by a pipeline. > > > > > > The flow should be > > > A->B->A if "Edit" or "Add new" are used. > > > A->A if "delete selected" or "save changes" are used. > > > > > > function editarRestaurantes() { > > > // Keep important things in vars, as they will be lost from > > > cocoon.parameters > > > var formDefinitionA =3D cocoon.parameters["form-definition-a"]; > > > var formDefinitionB =3D cocoon.parameters["form-definition-b"]; > > > var bindingURIA =3D cocoon.parameters["bindingURI-a"]; > > > var bindingURIBPrefix =3D cocoon.parameters["bindingURI-b-prefix"= ]; > > > var saveURI =3D cocoon.parameters.saveURI; > > > var saveXSLT =3D cocoon.parameters.saveXSLT; > > > var displayPipelineLista =3D cocoon.parameters["displayPipeline-a= "]; > > > var displayPipelineFicha =3D cocoon.parameters["displayPipeline-b= "]; > > > > > > var formLista =3D null; > > > var formFicha =3D null; > > > var formB =3D null; > > > > > > var datos =3D leerDatos(cocoon.parameters.loadURI); // Read the X= ML > > > file and store into "datos" > > > > > > formLista =3D createForm(formDefinitionA, bindingURIA, datos); > > > > > > while(true) { > > > > > > // display form A > > > formLista.showForm(displayPipelineLista); > > > > > > // ********************************* > > > // If I hit reload when form B is displayed, execution is resumed > > > here, but formLista is undefined > > > // Why is it "null"? Shouldn't it be restored to the previous value > > > because of my hitting "Reload". > > > // ********************************* > > > > > > var submitWidget =3D formLista.getWidget().getSubmitWidget(); > > > var idRestaurante =3D ""; > > > > > > // Did the user not click the "Save changes" button? > > > if(submitWidget!=3Dnull) { > > > cocoon.log.info(submitWidget); > > > // Did the user click "Add new"? > > > if(submitWidget.id=3D=3D"nuevo") { > > > // To add a new record, we ask the repeater to do so. > > > var repeater =3D > > > submitWidget.parent.lookupWidget('restaurantes'); > > > repeater.addRow(); > > > // New record is last, so get the repeater size > > > idRestaurante =3D repeater.size; > > > } else { > > > // Clicked "Edit", ... which row? > > > idRestaurante =3D > > > submitWidget.getParent().lookupWidget('id').value; > > > } > > > formLista.save(datos); > > > formLista =3D null; > > > > > > // Prepare form B, using the ID for the new or edited rec= ord > > > formFicha =3D createForm(formDefinitionB, > > > bindingURIBPrefix+idRestaurante, datos); > > > > > > // *********************** > > > // Form B is displayed on next line > > > // *********************** > > > > > > formFicha.showForm(displayPipelineFicha); > > > formFicha.save(datos); > > > formFicha =3D null; > > > > > > formLista =3D createForm(formDefinitionA, bindingURIA, da= tos); > > > } else { > > > formLista.save(datos); > > > } > > > grabarDatos(saveURI, saveURI+".tmp", saveXSLT, datos); > > > > > > } > > > } > > > > > > function createForm(definition, binding, datos) { > > > var form =3D new Form(definition); > > > if (binding !=3D null) { > > > form.createBinding(binding); > > > } > > > form.load(datos); > > > return form; > > > } > > > > > > > > > > > > Thank you very much for any hint, and sorry for the long e-mail. I > > > tried hard to make it shortest possible. > > > > > > Do you use GET or POST methods in form A? > > > > If you use GET, you display form B with a URL of the type > > "page?continuation-id=3DcontForA", which will be mixed with > the hidden > > "continuation-id" parameter in the form. Which one is sent first in the > > request is browser-dependent, and it may be the case that posting puts > > first the hidden field first whereas reloading just sends the > > continuation for formA which is in the URL. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org For additional commands, e-mail: users-help@cocoon.apache.org