You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Fevzi Yuekseldi <fe...@imis.ch> on 2009/04/15 09:28:51 UTC
Question: GetValue from for-loop
Hi all.
I have a for loop in a component and now i want to implement something
like AJAX.
The for-loop has a article-number(Textfield), description(Insert), and a
price(Insert) 5 times...
At the beginning all the fields are empty.
I set a method with a @Eventlistener annotation with target to the
article-number and the event "onkeyup".
Now my question: How can i get the Value, which the user typed in in the
"article-number" textfield?
After, if I have the value, i will set the other fields which are among
to the article-number...
Please help me...
Here is the code:
DirectOrderForm.java:
public abstract class DirectOrderForm extends BaseComponent
{
/**
* Logger
*/
Log log = LogFactory.getLog( DirectOrderForm.class );
public abstract Object getIterationValue();
public abstract Integer getIterationIndex();
public abstract List<ItemDigest> getItemsStore();
public abstract void setItemsStore(List<ItemDigest> items);
/**
* Hivemind service: document logic.
*
* @return DocumentLogic
*/
public abstract DirectOrderLogic getDirectOrderLogic();
public abstract DocumentLogic getDocumentLogic();
public List<ItemDigest> getItems() throws Exception
{
if(getItemsStore() != null)
{
return getItemsStore();
}
List<ItemDigest> list = new ArrayList<ItemDigest>();
list = getDirectOrderLogic().getDirectOrderItems(5);
setItemsStore(list);
return list;
}
@EventListener(events = "onkeyup", targets = {"articleNr"}, async =
true)
public void getArticleNumber(IRequestCycle cycle, BrowserEvent event)
{
String id = event.getTarget().get("id").toString();
log.info("PUT "+id+" ");
}
}
DirectOrderForm.html:
<table class="tablecontent">
<thead>
<tr>
<th class="artno">Atrikel-nr</th>
<th class="descr">Description</th>
<th class="price">price</th>
</tr>
</thead>
<tbody>
<tr jwcid="@For" source="ognl:items"
value="ognl:iterationValue"
index="ognl:iterationIndex" volatile="true">
<td jwcid="@Any">
<input autocomplete="off" class="smalltext"
jwcid="articleNr@TextField" value="ognl:iterationValue.articleNr" />
</td>
<td jwcid="@Any">
<span jwcid="description@Insert"
value="ognl:iterationValue.description" />
</td>
<td jwcid="@Any">
<span jwcid="price@Insert"
value="ognl:iterationValue.unitPrice" />
</td>
</tr>
</tbody>
</table>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org