Tapestry 4, get submitted value from non-component element
My form has a custom element like below, created using custom ajax:
<select jwcid="testtest <at> Any">
<option value="x">California -- CA</option>
<opt开发者_如何学Cion value="y">Colorado -- CO</option>
<option value="z">Connecticut -- CN</option>
</select>
After the form is submitted, how do I get the value of this custom html element?
cycle.getPage().getComponents().get("testtest")
?
If I understand you correctly, you have a form element generated not by Tapestry, but by something else.
First of all, jwcid
has no place in your HTML code, it's only used in Tapestry component templates. Second, the select
element must have a name
attribute or else your browser won't submit it at all:
<select name="name-of-element">
...
</select>
To get the submitted value on the server side, use cycle.getParameter("name-of-element")
in your page/component class.
精彩评论