You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Schips Markus <ma...@de.munksjo.com> on 2007/07/05 16:28:50 UTC

No OPTION Tags rendered for PropertySelection after updateComponents

Hy there... 

its my first post on this list and I haven't found anything regarding my
actual Tapestry 4.1.2 Problem.

See the example below.

HTML-Template:
<html jwcid=3D"@Shell" title=3D"Test" debugEnabled=3D"false">
<head>
</head>
<body jwcid=3D"@Body">
<form jwcid=3D"@Form" id=3D"testForm">
<a href=3D"" jwcid=3D"change">change</a>
<select jwcid=3D"selection"></select>
</form>
</body>
</html>


Page:
<page-specification>

	<property name=3D"testArray" initial-value=3D'new java.lang.String[]
{"A","B","C"}'/>

	<component id=3D"change" type=3D"DirectLink">
		<binding name=3D"listener" value=3D"listener:onChange"/>
		<binding name=3D"async" value=3D"true"/>
		<binding name=3D"updateComponents"
value=3D"ognl:{'selection'}"/>
	</component>
	
	<component id=3D"selection" type=3D"PropertySelection">
		<binding name=3D"model" value=3D"model"/>
		<binding name=3D"value" value=3D"name"/>
	</component>
	
</page-specification>


Java:
public abstract class Test extends BasePage {

	public abstract String[] getTestArray();
	public abstract void setTestArray(String[] testArray);
	
	public IPropertySelectionModel getModel() {
		return new StringPropertySelectionModel(getTestArray());
	}

	public void onChange() {
		setTestArray(new String[]{"1","2","3","4"});
	}
}

The test consists of a DirectLink Component and a PropertySelection.
The PropertySelection is initialized with a StringPropertySelectionModel
and should change its options when the DirectLink is clicked.

The first call of the Page shows that the PropertySelection is working:
...
<select name=3D"selection" id=3D"selection">
<option value=3D"0">A</option>
<option value=3D"1">B</option>
<option value=3D"2">C</option>
</select>
...

But after the DirectLink is triggered, something went wrong:
...
<select name=3D"selection" id=3D"selection">1234</select>
...

No OPTION Tags were rendered.

--=0A=
This email and any files transmitted with it are confidential and intended s=
olely for the use of the individual or entity to whom they are addressed. If=
 you have received this email in error please notify our systems manager at=
 info@de.munksjo.com.

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


Re: No OPTION Tags rendered for PropertySelection after updateComponents

Posted by Steve Shucker <ss...@vmsinfo.com>.
I see two things off the top:
- DirectLink won't rewind the form.  You should really be using 
LinkSubmit if you want to capture the selected value.
- The updateComponents property of the DirectLink might work, but it's 
not guaranteed if you have multiple instances of this component or a 
name collision.  The good way to pass a component to this list is with 
"components.selection.clientId" rather than hardcoding the name.

I don't think either of these problems should be causing the breakage 
you're seeing.  One thing to try would be to wrap "selection" in a <span 
jwcid="refresh@Any"><select jwcid="selection"/></span> and pass the span 
for update.  No idea if it'll help, but just something to try.

-Steve

Schips Markus wrote:
> Hy there... 
>
> its my first post on this list and I haven't found anything regarding my
> actual Tapestry 4.1.2 Problem.
>
> See the example below.
>
> HTML-Template:
> <html jwcid="@Shell" title="Test" debugEnabled="false">
> <head>
> </head>
> <body jwcid="@Body">
> <form jwcid="@Form" id="testForm">
> <a href="" jwcid="change">change</a>
> <select jwcid="selection"></select>
> </form>
> </body>
> </html>
>
>
> Page:
> <page-specification>
>
> 	<property name="testArray" initial-value='new java.lang.String[]
> {"A","B","C"}'/>
>
> 	<component id="change" type="DirectLink">
> 		<binding name="listener" value="listener:onChange"/>
> 		<binding name="async" value="true"/>
> 		<binding name="updateComponents"
> value="ognl:{'selection'}"/>
> 	</component>
> 	
> 	<component id="selection" type="PropertySelection">
> 		<binding name="model" value="model"/>
> 		<binding name="value" value="name"/>
> 	</component>
> 	
> </page-specification>
>
>
> Java:
> public abstract class Test extends BasePage {
>
> 	public abstract String[] getTestArray();
> 	public abstract void setTestArray(String[] testArray);
> 	
> 	public IPropertySelectionModel getModel() {
> 		return new StringPropertySelectionModel(getTestArray());
> 	}
>
> 	public void onChange() {
> 		setTestArray(new String[]{"1","2","3","4"});
> 	}
> }
>
> The test consists of a DirectLink Component and a PropertySelection.
> The PropertySelection is initialized with a StringPropertySelectionModel
> and should change its options when the DirectLink is clicked.
>
> The first call of the Page shows that the PropertySelection is working:
> ...
> <select name="selection" id="selection">
> <option value="0">A</option>
> <option value="1">B</option>
> <option value="2">C</option>
> </select>
> ...
>
> But after the DirectLink is triggered, something went wrong:
> ...
> <select name="selection" id="selection">1234</select>
> ...
>
> No OPTION Tags were rendered.
>
> --
> This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify our systems manager at info@de.munksjo.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>   

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


Re: No OPTION Tags rendered for PropertySelection after updateComponents

Posted by Marcus Schulte <et...@googlemail.com>.
don't know, what's exactly wrong, but:

 - the id-attribute in the form-tag is suspicious. That's normally a
reserved parameter, you should get an error.

- where do you see the 1234 without the option-tags? in the dom-tree after
the request? or in the debug output in the browser?

- if you didn't do that already, try enabling client-side debug by setting
debugEnabled=true in the Shell component.

- In which Browser are you seeing this?

2007/7/5, Schips Markus <ma...@de.munksjo.com>:
>
> Hy there...
>
> its my first post on this list and I haven't found anything regarding my
> actual Tapestry 4.1.2 Problem.
>
> See the example below.
>
> HTML-Template:
> <html jwcid="@Shell" title="Test" debugEnabled="false">
> <head>
> </head>
> <body jwcid="@Body">
> <form jwcid="@Form" id="testForm">
> <a href="" jwcid="change">change</a>
> <select jwcid="selection"></select>
> </form>
> </body>
> </html>
>
>
> Page:
> <page-specification>
>
>         <property name="testArray" initial-value='new java.lang.String[]
> {"A","B","C"}'/>
>
>         <component id="change" type="DirectLink">
>                 <binding name="listener" value="listener:onChange"/>
>                 <binding name="async" value="true"/>
>                 <binding name="updateComponents"
> value="ognl:{'selection'}"/>
>         </component>
>
>         <component id="selection" type="PropertySelection">
>                 <binding name="model" value="model"/>
>                 <binding name="value" value="name"/>
>         </component>
>
> </page-specification>
>
>
> Java:
> public abstract class Test extends BasePage {
>
>         public abstract String[] getTestArray();
>         public abstract void setTestArray(String[] testArray);
>
>         public IPropertySelectionModel getModel() {
>                 return new StringPropertySelectionModel(getTestArray());
>         }
>
>         public void onChange() {
>                 setTestArray(new String[]{"1","2","3","4"});
>         }
> }
>
> The test consists of a DirectLink Component and a PropertySelection.
> The PropertySelection is initialized with a StringPropertySelectionModel
> and should change its options when the DirectLink is clicked.
>
> The first call of the Page shows that the PropertySelection is working:
> ...
> <select name="selection" id="selection">
> <option value="0">A</option>
> <option value="1">B</option>
> <option value="2">C</option>
> </select>
> ...
>
> But after the DirectLink is triggered, something went wrong:
> ...
> <select name="selection" id="selection">1234</select>
> ...
>
> No OPTION Tags were rendered.
>
> --
> This email and any files transmitted with it are confidential and intended
> solely for the use of the individual or entity to whom they are addressed.
> If you have received this email in error please notify our systems manager
> at info@de.munksjo.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Marcus Schulte
http://marcus-schulte.blogspot.com