You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Duncan McLean <du...@blueyonder.co.uk> on 2006/01/24 12:32:22 UTC

Simlpe forms question (I hope)

Hi

How can I set a default value for a radio button?
In this example we have 2 options (Single, Joint), and want Single to be
default.

I know we can set the value in flow, but this would mean that the value
would always be set to that value wouldn't it? What I mean is that if we
take the example above, and the user clicked "Joint" and submitted the
form, then subsequently returned to that form, the flow code would
kick in and reset the value back to "Single" losing the users choice - or
am I incorrect in that assumption?

Here's the relevant fragment of the form def:

    <fd:field id="kwdSingleJoint">
		<fd:label>Is this policy a Single Life or Joint Life policy?</fd:label>
		<fd:datatype base="string"/>
		<fd:selection-list>
			<fd:item value="Single"/>
			<fd:item value="Joint"/>
		</fd:selection-list>
	</fd:field>

I was hoping that "<fd:initial-value>Single</fd:initial-value>" would
work, but no luck.

Any suggestions on how this can be achieved?

Thanks

Duncan


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


Re: Simlpe forms question (I hope)

Posted by Bruno Dumon <br...@outerthought.org>.
On Tue, 2006-01-24 at 11:32 +0000, Duncan McLean wrote:
> Hi
> 
> How can I set a default value for a radio button?
> In this example we have 2 options (Single, Joint), and want Single to be
> default.
> 
> I know we can set the value in flow, but this would mean that the value
> would always be set to that value wouldn't it? What I mean is that if we
> take the example above, and the user clicked "Joint" and submitted the
> form, then subsequently returned to that form, the flow code would
> kick in and reset the value back to "Single" losing the users choice - or
> am I incorrect in that assumption?
> 
> Here's the relevant fragment of the form def:
> 
>     <fd:field id="kwdSingleJoint">
> 		<fd:label>Is this policy a Single Life or Joint Life policy?</fd:label>
> 		<fd:datatype base="string"/>
> 		<fd:selection-list>
> 			<fd:item value="Single"/>
> 			<fd:item value="Joint"/>
> 		</fd:selection-list>
> 	</fd:field>
> 
> I was hoping that "<fd:initial-value>Single</fd:initial-value>" would
> work, but no luck.
> 
> Any suggestions on how this can be achieved?

fd:initial-value should work, at least if you are using Cocoon 2.1.8 (I
don't know exactly in which version this feature was introduced).

-- 
Bruno Dumon                             http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
bruno@outerthought.org                          bruno@apache.org


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


Re: Simlpe forms question (I hope)

Posted by David Verdin <ve...@agrocampus-rennes.fr>.
You should probably try the binding framework, whose functionnalities 
allow, among other things, to load a form taking into account previously 
typed informations stored in a java bean or an XML document.

Hope that helps.

David

Duncan McLean wrote:

>Hi
>
>How can I set a default value for a radio button?
>In this example we have 2 options (Single, Joint), and want Single to be
>default.
>
>I know we can set the value in flow, but this would mean that the value
>would always be set to that value wouldn't it? What I mean is that if we
>take the example above, and the user clicked "Joint" and submitted the
>form, then subsequently returned to that form, the flow code would
>kick in and reset the value back to "Single" losing the users choice - or
>am I incorrect in that assumption?
>
>Here's the relevant fragment of the form def:
>
>    <fd:field id="kwdSingleJoint">
>		<fd:label>Is this policy a Single Life or Joint Life policy?</fd:label>
>		<fd:datatype base="string"/>
>		<fd:selection-list>
>			<fd:item value="Single"/>
>			<fd:item value="Joint"/>
>		</fd:selection-list>
>	</fd:field>
>
>I was hoping that "<fd:initial-value>Single</fd:initial-value>" would
>work, but no luck.
>
>Any suggestions on how this can be achieved?
>
>Thanks
>
>Duncan
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>For additional commands, e-mail: users-help@cocoon.apache.org
>
>
>
>  
>

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