Return-Path: Delivered-To: apmail-cocoon-users-archive@www.apache.org Received: (qmail 4582 invoked from network); 5 Oct 2005 16:30:37 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 5 Oct 2005 16:30:37 -0000 Received: (qmail 94918 invoked by uid 500); 5 Oct 2005 12:23:40 -0000 Delivered-To: apmail-cocoon-users-archive@cocoon.apache.org Received: (qmail 94874 invoked by uid 500); 5 Oct 2005 12:23:40 -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 94863 invoked by uid 99); 5 Oct 2005 12:23:40 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Oct 2005 05:23:40 -0700 X-ASF-Spam-Status: No, hits=0.1 required=10.0 tests=HTML_40_50,HTML_MESSAGE,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.202 as permitted sender) Received: from [64.233.184.202] (HELO wproxy.gmail.com) (64.233.184.202) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Oct 2005 05:23:44 -0700 Received: by wproxy.gmail.com with SMTP id 69so59147wri for ; Wed, 05 Oct 2005 05:23:18 -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:references; b=WZOrsxj3CLFRq72Ui9w1l6Rma9c9Ugle/rRBw2tDdvyIJWAAhbc7UIe7p/8ukp3Bx8AdVkhQ4sQm2vtO1aNwb4eos0N4rhKGChd9ETSL9Xl6LL93rPds8Xn+IrCP3l3cg+PkJMkkdF18kYw6y4Z3djOZGmMcpvK1gZ/pHlRZaS4= Received: by 10.54.135.7 with SMTP id i7mr37225wrd; Wed, 05 Oct 2005 05:23:17 -0700 (PDT) Received: by 10.54.89.5 with HTTP; Wed, 5 Oct 2005 05:23:17 -0700 (PDT) Message-ID: Date: Wed, 5 Oct 2005 14:23:17 +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: <4342AF4A.9070708@apache.org> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_10327_32710547.1128514997775" 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 ------=_Part_10327_32710547.1128514997775 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hello, Thank you for replying. I'm using POST. The template for A is: ...
... The template for B (if that matters): ...

... 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 code > > managing it), a standard HTML submit button, and an edit submit button > > 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 XML > > 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 record > > 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, datos); > > } 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. > -- Antonio ------=_Part_10327_32710547.1128514997775 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hello,

Thank you for replying.

I'm using POST.

The template for A is:
...
    <ft:form-template action=3D"#{$continuation/id}.= continue" method=3D"POST">
      <div class=3D"ficha">
        <ft:widget id=3D"delrest= aurante"/>
          <ft:widget id=3D&= quot;nuevo"/>
        <input type=3D"submit&qu= ot; value=3D"GUARDAR cambios" style=3D"font-weight: bold;&qu= ot;/>
...

The template for B (if that matters):
...
    <ft:form-template action=3D"#{$continuation/id}.= continue" method=3D"POST">
        <h2><ft:widget-label id= =3D"nombre"/></h2>
        <p><ft:widget id=3D&quo= t;nombre"/></p>
...

I am not using any parameters on the URL query string.



2005/10/4, Sylvain Wallez <sylvain@apache.org>: Antonio Fiol Bonn=EDn wrote:

> Hello,
>
> I am having= strange problems (described below) when hitting the
> "reload&q= uot; button on my browser when displaying form B in scenario
> descri= bed below. Could anyone please help me understand why?
>
> I am using a 2-form approach to editing an XML file, one f= or 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 j= s code
> managing it), a standard HTML submit button, and an edit sub= mit button
> on each row.
>
> Example:
> [Delete selected] [A= dd 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 <mailto: a@b.c>]
> [Save changes]
>
> So the binding for B = is dynamically generated by a pipeline.
>
> The flow should be<= br>> A->B->A if "Edit" or "Add new" are used.
> A->A if "delete selected" or "save changes"= are used.
>
> function editarRestaurantes() {
> &nb= sp;   // Keep important things in vars, as they will be lost from=
> cocoon.parameters
>     var formDefinitionA =3D cocoon.parameters[= "form-definition-a"];
>     var formDef= initionB =3D cocoon.parameters["form-definition-b"];
> = ;    var bindingURIA =3D cocoon.parameters["bindingURI-= a"];
>     var bindingURIBPrefix =3D cocoon.parameter= s["bindingURI-b-prefix"];
>     var sav= eURI =3D cocoon.parameters.saveURI;
>     var sav= eXSLT =3D cocoon.parameters.saveXSLT;
>     var d= isplayPipelineLista =3D=20 cocoon.parameters["displayPipeline-a"];
>   =   var displayPipelineFicha =3D cocoon.parameters["displayPipeline= -b"];
>
>     var formLista =3D null;<= br>>     var formFicha =3D null;
>  =    var formB =3D null;
>
>     var datos =3D leerDatos(cocoon.par= ameters.loadURI); // Read the XML
> file and store into "datos&q= uot;
>
>     formLista =3D createForm(formD= efinitionA, bindingURIA, datos);
>
>     while(true) {
>
>  &= nbsp;       // display form A
>&nb= sp;         formLista.showForm= (displayPipelineLista);
>
> // ********************************= *
> // If I hit reload when form B is displayed, execution is resumed
> here, but formLista is undefined
> // Why is it "null&q= uot;? Shouldn't it be restored to the previous value
> because of my = hitting "Reload".
> // *********************************
>
>         var submit= Widget =3D formLista.getWidget().getSubmitWidget();
>  &nbs= p;      var idRestaurante =3D "";
>= ;
>         // Did the user n= ot click the "Save changes" button?
>         if(submitWidget!= =3Dnull) {
>         &nb= sp;   cocoon.log.info(submitWidget);
>   &nb= sp;         // Did the user click &= quot;Add new"?
>        =      if(submitWidget.id=3D=3D"nuevo") {
&g= t;            &= nbsp;    // To add a new record, we ask the repeater to do so.
>  &n= bsp;            = ;  var repeater =3D
> submitWidget.parent.lookupWidget('restaura= ntes');
>          =        repeater.addRow();
>  =             &nb= sp;  // New record is last, so get the repeater size
>   &n= bsp;            = ; idRestaurante =3D repeater.size;
>      = ;       } else {
>   &nb= sp;             // Clicked "Edit", ... which row?
>    =              id= Restaurante =3D
> submitWidget.getParent().lookupWidget('id').value;<= br>>           &n= bsp; }
>          &= nbsp;  formLista.save(datos);
>     &nb= sp;       formLista =3D null;
>
>          = ;   // Prepare form B, using the ID for the new or edited record
> &= nbsp;           formFicha= =3D createForm(formDefinitionB,
> bindingURIBPrefix+idRestaurante, d= atos);
>
> // ***********************
> // Form B is disp= layed on next line
> // ***********************
>
>    =          formFicha.showForm(display= PipelineFicha);
>        &nbs= p;    formFicha.save(datos);
>    =          formFicha =3D null;
>= ;
>           =   formLista =3D createForm(formDefinitionA, bindingURIA, datos);
> = ;        } else {
>  &nb= sp;          formLista.save(da= tos);
>         }
>&nbs= p;        grabarDatos(saveURI, saveURI+&= quot;.tmp", saveXSLT, datos);
>
>     }
> }
>
> functi= on createForm(definition, binding, datos) {
>    = var form =3D new Form(definition);
>     if (bin= ding !=3D null) {
>         f= orm.createBinding(binding);
>     }
>     form.loa= d(datos);
>     return form;
> }
>>
>
> Thank you very much for any hint, and sorry for the l= ong 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
"continuatio= n-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<= br>first the hidden field first whereas reloading just sends the
continu= ation for formA which is in the URL.


--
Antonio ------=_Part_10327_32710547.1128514997775--