Hi,
On Fri, Mar 12, 2021, 15:13 Per Newgro <[email protected]> wrote:
> Hi,
>
> i would like to add some input fields to an ul/li using JS.
>
> <code>
> <script type="text/javascript">
> function add_fields() {
> var d = document.getElementById("items");
> var i = d.childElementCount;
> d.innerHTML += "<li><input name=\"item:" + i + ":value\" /></li>";
> }
> </script>
>
> <form id="form" wicket:id="form">
> <input type="button" id="more_fields" onclick="add_fields();"
> value="Add More" />
> <ul id="items">
> <li wicket:id="item">
> <input wicket:id="value" />
> </li>
> </ul>
> <input type="submit" value="Go" />
> </form>
> </code>
>
> Currently in Form.onSubmit values are empty.
>
> Is this possible? Is there an example for this?
>
Yes, I don't see why not.
Check whether the values are submitted in the browser's DevTools>Network
tab.
At the server side you don't have the corresponding Wicket Form components
so you need to use Request.getParameterNames() and
getParameterValue(String)
> Thanks for your support
> Per
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>