cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Duncan McLean" <duncan_mcl...@blueyonder.co.uk>
Subject Re: 'Losing data' when hiding/showing group in form
Date Wed, 01 Feb 2006 11:32:52 GMT
> Hi
>
> Hope someone can help.
>
> I have a relatively simple form, which amongst other things will
> hide/show a group of fields depending on the state of a radio button.
>
> There are two groups "Life1" and "Life2".
>
> - Life1 is always shown
> - Life2 is only shown when the radio button is set to "Joint" (and has an
> initial state of "invisible".
>
> The hiding/showing mechanism works fine, however, when I submit the form
> after selecting Joint and entering data, and later revisit that form, the
> data in the Life2 group is not preserved. Life1 group is unaffected.
>
> Anybody know why this is occurring?
>
> Relevant parts of form:
>
> Radio button def:
>
>     <fd:field id="kwdSingleJoint">
> 		<fd:label>Is this policy a Single Life or Joint Life policy?</fd:label>
> 		<fd:datatype base="string"/>
>         <fd:initial-value>Single</fd:initial-value>
> 		<fd:selection-list>
> 			<fd:item value="Single"/>
> 			<fd:item value="Joint"/>
> 		</fd:selection-list>
> 		<fd:on-value-changed>
> 			<javascript>
> 			  var value = event.source.value;
> 			  var life2widget = event.source.lookupWidget("../life2");
> 			  if (value == "Joint")
> 			  {
> 				life2widget.setState(Packages.org.apache.cocoon.forms.formmodel.WidgetState.ACTIVE);
> 			  }
> 			  else
> 			  {
> 				life2widget.setState(Packages.org.apache.cocoon.forms.formmodel.WidgetState.INVISIBLE);
> 			  }
> 			</javascript>
> 		</fd:on-value-changed>
> 	</fd:field>
>
>
> and part of Life2 def:
>
> 	<fd:group id="life2" state="invisible">
> 	  <fd:widgets>
> 		<fd:field id="title2">
> 		  <fd:label>Title</fd:label>
> 		  <fd:datatype base="string" />
> 		  <fd:selection-list>
> 			   <fd:item value="Mr"/>
> 			   <fd:item value="Mrs"/>
> 			   <fd:item value="Miss"/>
> 			   <fd:item value="Ms"/>
> 			   <fd:item value="Dr"/>
> 			   <fd:item value="Fr"/>
> 			   <fd:item value="Br"/>
> 			   <fd:item value="Sr"/>
> 			   <fd:item value="Rev"/>
> 		  </fd:selection-list>
> 		</fd:field>
>
> 		<fd:field id="firstName2">
> 			<fd:label>First Name</fd:label>
> 			<fd:datatype base="string" />
> 		</fd:field>
>
>                 etc...
>
>          <fd:group>
>
> Thanks in advance
>
> Duncan
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>
>

Digging a bit deeper, I find that upon first submit of the form (and only
choosing Life1 as clicking the radio button causes a submit action) then
going back in the browser, the data is retained.

If I even update any other field on the page then do another submit, this
data is not retained - why is it then that only the initial submit data is
"saved"?

Should also put the simplified "stripped down" flow in as well:
~
~
    var form = new Form("forms/start_def.xml");
    var form2 = new Form("forms/clientdetails_def.xml");
    var form3 = new Form("forms/policydetails_sib_def.xml");

    form.showForm("start-display-pipeline");

    //causing me problems at the moment
    form2.showForm("clientdetails-display-pipeline");


    form3.showForm("policydetails_sib-display-pipeline");
~
~

Thanks


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message