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 Getting text value from dropdown list in form
Date Thu, 16 Feb 2006 11:29:18 GMT
Hi

I have a form definition which contains the following test selection list

<fd:field id="prodType" required="true">
	<fd:label>Type of product:</fd:label>
	<fd:datatype base="string"/>
	<fd:selection-list>
		<fd:item value="val1">
			<fd:label>Text 1</fd:label>
		</fd:item>
		<fd:item value="val2">
			<fd:label>Text 2</fd:label>
		</fd:item>
		<fd:item value="val3">
			<fd:label>Text 3</fd:label>
		</fd:item>
	</fd:selection-list>
		<fd:on-value-changed>
		<javascript>
			var value = event.source.value;
			var myTextField = event.source.lookupWidget("../myTextField");
			myTextField.setValue(value);
		</javascript>
	</fd:on-value-changed>
</fd:field>

I want to be able to write out the text of the selected list to a hidden
field (in the case "myTextField") when the value changes.

Currently the code takes the value - so if I select Text 2 for instance,
it writes out "val2" to the hidden field (obviously because of:
var value = event.source.value;).

Can I capture the text in the dropdown list in a similar way so, as per
the example above, "Text 2" gets written to the hidden field no "val2"?

Thanks

Duncan



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


Mime
View raw message