You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Ben Anderson <be...@gmail.com> on 2004/12/16 14:21:23 UTC

forms newbie

I just want to set a field in a form before I display it.  I'm
assuming I can set a default value in the form definition, but I was
trying to set it explicity in my flow script.

simple form definition
		<fd:field id="documentName" required="true">
			<fd:label>Document Name:</fd:label>
			<fd:datatype base="string"/>
		</fd:field>

flow script
	var form = new Form("forms/index.xml");
	var data = new Object();
	data.documentName = {value:"hello"};
	var k = form.showForm("index-display", data);

Assuming I have all the other steps in place - should this work?  I'm
thinking I'm not doing the flow script correctly?  The label shows up,
but the value doesn't seem to be set.

Thanks,
Ben

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


Re: forms newbie

Posted by Reinhard Poetz <re...@apache.org>.
Ben Anderson wrote:
> I just want to set a field in a form before I display it.  I'm
> assuming I can set a default value in the form definition, but I was
> trying to set it explicity in my flow script.
> 
> simple form definition
> 		<fd:field id="documentName" required="true">
> 			<fd:label>Document Name:</fd:label>
> 			<fd:datatype base="string"/>
> 		</fd:field>
> 
> flow script
> 	var form = new Form("forms/index.xml");

         form.lookupWidget("documentName").value = "value";

> 	var data = new Object();
> 	data.documentName = {value:"hello"};
> 	var k = form.showForm("index-display", data);

         var k = form.showForm("index-display");

-- 
Reinhard

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