Indeed it should. I didn't check all the code I copied.
If you use an expansion ${color}, just the value of the property color
gets inserted there and Tapestry doesn't has access to the property
color. This was the first error reported in this thread.
Jayson Pierringer schrieb:
I haven't ever seen anything like value="${teste}" in the tml either.
I think that should just be value="teste". You used the @Property
attribute in your java page so tapestry will magically create your
getter and setter. Tapestry will then use that getter and setter for
the value.
For a good example of how to use checkboxes and radio buttons take a
look at this page example:
http://jumpstart.doublenegative.com.au:8080/jumpstart/examples/component/coreinputcomponents
Jayson
Tobias Wehrum wrote:
Hello,
while I've never worked with the Radio Component before, I assume
from the URL I provided to you that it should look like this:
Class:
-----------------------------------
[...]
@Property
private String currentColor;
@Property
private String chosenColor;
[...]
void onSubmit() {
System.out.println("aqui.........: " + chosenColor);
}
[...]
-----------------------------------
Template:
-----------------------------------
<form t:type="form" t:id="myForm">
<input t:type="submit" t:name="${teste}" value="${teste}"/> ${teste}
<br/>
<t:radiogroup value="chosenColor">
<t:loop source="colors" value="currentColor">
<t:radio value="currentColor"/> ${currentColor}
</t:loop>
</t:radiogroup>
<br/>
<input t:type="submit"/>
</form>
-----------------------------------
Code is untested and maybe needs to be tweaked a bit.
- Tobias
Gutemberg A. Da Silva schrieb:
Ok guys, so
--> my Class Code
public class CheckBoxClass {
@Property
private String teste = "teste";
@Property
private final String[] colors = { "Blue", "Red", "Green" };
@Property
private String color;
@Property
private boolean color1 = false;
public void setColor1() {
this.color1 = true;
}
void onSubmit() {
System.out.println("aqui.........: " + color);
}
}
--> my TML Code
<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
<head>
<title>agenda Start Page</title>
</head>
<body>
<form t:type="form" t:id="myForm">
<input t:type="submit" t:name="${teste}" value="${teste}"/>
${teste}
<br/>
<t:loop source="colors" value="color">
<t:checkbox name="color1" value="color1"/> ${color}
</t:loop>
<br/>
<input t:type="submit"/>
</form>
</body>
</html>
I have three items: Blue, Green and Red.
So I want to print the value of "Colors" by selected item.
I need simple example.
2009/1/6 Tobias Wehrum <leg...@dragonlab.de>
Hello,
I'm not seeing where you are using the Radio Component?
I suggest you take a look at
http://tapestry.apache.org/tapestry5/tapestry-core/ref/org/apache/tapestry5/corelib/components/Radio.html
and combine it with your loop.
Hope that helped,
Tobias
Gutemberg A. Da Silva schrieb:
Hi guys,
I have a problem with "RadioButton Component". I have this class:
<!-- Class -->
public class CheckBoxClass {
@Property
private final String[] colors = { "Blue", "Red", "Green" };
@Property
private String color;
@Property
private String teste;
@Property
private boolean color1 = false;
//@BeginRender
void onPrepare(String id) {
//color1 = true;
if (color1) {
System.out.println("verdade..: " + id);
} else {
System.out.println("falso..: " + id);
}
}
void onActivate(String id) {
System.out.println("++++++++++++++++ " + id);
}
}
and have this TML:
<!-- TML -->
<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
<head>
<title>agenda Start Page</title>
</head>
<body>
<form t:type="form" t:id="myForm">
<table>
<tr t:type="loop" source="colors" value="color" >
<td>
<t:checkbox
controller="colorController"
value="${color1}" context="${color}"/>
${color}
</td>
</tr>
<br/>
<input t:type="submit"/>
</table>
</form>
</body>
</html>
when I click on Submit, it is shownd this error:
Failure writing parameter 'value' of component
CheckBoxClass:checkbox:
Binding
org.apache.tapestry5.internal.services.attributeexpansionbind...@1f68272is
read-only.
context
eventTypeaction
Can somebody help me in this Class Test with the "RadioButton"
component?
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org