Hi Chris!

I don't think that's possible to achieve with t:submit.

However, a little JavaScript could do the job of submitting the form after
selecting a radio with something like this (untested and off the top of my
head) code:

<t:radiogroup t:id="service" t:value="prop:value">
    <t:loop t:source="prop:buttons" t:value="prop:paneButton">
        <t:radio t:value="prop:paneButton"
onchange="this.form.submit()">${prop:buttonLabel}</t:radio>
    </t:loop>
</t:radiogroup>

Alternatively, you could use onclick, if clicking an already selected
option should also submit the form.

Another way would be a hidden field that is updated on a button click via
JS before submitting, if you want to use buttons instead of radios.

Cheers
Ben

On Thu, Jul 3, 2025 at 7:56 AM Christopher Dodunski (Tapestry) <
chrisfromtapes...@christopher.net.nz> wrote:

> Hi all,
>
> I have a simple but unusual use case for a Tapestry form, whereby its
> output will be one of 27 options: A to Z plus an asterisk (for all).
>
> Obviously I could take the conventional approach of using 27 radio
> buttons along with a submit button.  This would require two clicks from
> the user.  I figured, however, why not simply have 27 submit buttons so
> a selection can be made from a single click.  This would require,
> however, each of the buttons having 'context' so I can know which button
> was clicked.
>
> Would Tapestry support a fieldless form such as this?  As I've
> encountered some difficulty extracting the below context field from
> inside the code.
>
> A snippet from the TML:
>
>          <t:loop source="buttons" value="paneButton">
>              <input t:type="submit" t:id="tap" t:context="paneButton"
> t:defer="false" class="btn ${buttonStyling}" value="${buttonLabel}" />
>          </t:loop>
>
> Kind regards,
>
> Chris.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>

Reply via email to