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 "Losing data" when hiding/showing group in form
Date Wed, 01 Feb 2006 10:21:04 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


Mime
View raw message