You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by "Magnus Kvalheim (JIRA)" <ji...@apache.org> on 2013/11/22 09:24:35 UTC

[jira] [Created] (TAP5-2231) Ajax form submits all possible radio values

Magnus Kvalheim created TAP5-2231:
-------------------------------------

             Summary: Ajax form submits all possible radio values
                 Key: TAP5-2231
                 URL: https://issues.apache.org/jira/browse/TAP5-2231
             Project: Tapestry 5
          Issue Type: Bug
          Components: tapestry-core
    Affects Versions: 5.4
            Reporter: Magnus Kvalheim


Just notised a strange issue with radio ajax/zone submit. It submits all values - selected and not selected.

- If I disable javascript - then it submits single value. Correct
- If I remove form t:zone then it also submits fine. Correct

If I enable t:zone then it submits all possible radio values.

Simple test case:

{code:title=tml|borderStyle=solid}
<h2>Selected type: ${type}</h2>
<t:zone t:id="formZone">
	<t:form t:zone="^" t:id="radioForm">

		<t:label for="type" />:

		 <t:radiogroup t:id="type">
			<t:radio t:id="masterCard" />
			<t:label for="masterCard" />
			<t:radio t:id="visa" />
			<t:label for="visa" />
			<t:radio t:id="amex" />
			<t:label for="amex" />
			<t:radio t:id="dinersClub" />
			<t:label for="dinersClub" />
			<t:radio t:id="discover" />
			<t:label for="discover" />
		</t:radiogroup>
		
		<t:submit/>

	</t:form>
</t:zone>
{code}

{code:title=java|borderStyle=solid}
public enum CardType{MASTER_CARD, VISA, AMERICAN_EXPRESS, DINERS_CLUB, DISCOVER}

@InjectComponent private Zone formZone;
@Inject private Request request;

@Property
@Persist
private CardType type;

public CardType getMasterCard() { return CardType.MASTER_CARD; }

public CardType getVisa() { return CardType.VISA; }

public CardType getAmex() { return CardType.AMERICAN_EXPRESS; }

public CardType getDinersClub() { return CardType.DINERS_CLUB; }

public CardType getDiscover() { return CardType.DISCOVER; }

Object onSubmitFromRadioForm() {
	return request.isXHR() ? formZone.getBody() : null;
}
{code}

{panel:title=Request Form data}

t:zoneid:formZone
t:submit:["submit_19b3a276fbae1_0","submit_0"]
t:formdata:hxLFSgWPQ9kZJpyI3CYQavAif/A=:H4sIAAAAAAAAAFvzloG1XIxBpCS1uEQ/KLW4ID+vOLMs1aqksiC1uIjBIr8oXS+xIDE5I1WvJBEoVFJUaaqXnF+UmpOZBKRzgepT80qK9YISUzLz3YvySwtUglNLSgsmGuzT2cz3+RATA6MPA3dyfl5JUX6OX2JuagmDkE9WYlmifk5iXrp+cElRZl66dUVBCQMLyEo8TjEhwymGpypOndoU/HcfEwNDRUG5BIMYuuHFpUm5mSVA4x2INT4YrEMloCg/ObW4GMwrLs7Mz5sZ/Ely65YWZyYGJh8GjuScTKBqz5RChjpwCKTmpOYCBUAhABYC+VgMYnm8oWWScaKRuVlaUmKqYbxBCQMHVMIAANTuUEWeAQAA
type:MASTER_CARD
type:VISA
type:AMERICAN_EXPRESS
type:DINERS_CLUB
type:DISCOVER

Looks like the "forms.gatherParameters (forms.js)" is adding all values - and not just the checked one.
{panel}



--
This message was sent by Atlassian JIRA
(v6.1#6144)