You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Francois Meillet <fr...@gmail.com> on 2015/07/02 23:47:02 UTC

problem submitting a form twice - quickstart joined

Description
-----------------
In the quickstart, the HomePage contains a form.

The form's model is a CompoundPropertyModel<>(new QuestionUnit(Boolean.TRUE));
The QuestionUnit class has 2 properties, one is mandatory (string 'question').
Properties use validation annotations.

The validation is done with javax.validation.Validator, 
so a call to BeanValidationConfiguration().configure(this) is done in the application init.

The form contains 2 formcomponents (1 TextField 'question' mandatory and 1 CheckBox 'onoff' ) + 1 FeedbackLabel (extends Label).
If an error occurs when the form is submitted, a call from within the AjaxButton's onError method 
to the FormFieldEnlighter helper class is done.

The FormFieldEnlighter updates the FeedbackLabel's model's value,
and add an AttributeModifier to the TextField to modify the 'title' attribute.
Then the textfield and the feedbackLabel are resent via ajax.

When this form is submitted, for the first time, with nothing typed, an error occurs.
Which is normal.
The FeedbackLabel displays an error message.

If some characters are typed in the textfield and the form submitted again,
the textfield is still invalid.
Which is the problem.

But if, at the first submit with the error, the helper class FormFieldEnlighter does not resent the invalid textfield, 
the second submit works correctly, the form is valid and the ResultPage is displayed.



What I have found
-----------------
Looking at FormComponent - line 755 
List<StringValue> list = getRequest().getRequestParameters().getParameterValues(getInputName());
list is null
The textfield id is not in the parameters name.



environnement
-------------
mac osx / jdk 8 / safari & firefox


Thanks for your help
Fran�ois



Re: problem submitting a form twice - quickstart joined

Posted by Francois Meillet <fr...@gmail.com>.
1000 thanks !

François 








Le 3 juil. 2015 à 09:47, Sven Meier <sv...@meiers.net> a écrit :

> Hi,
> 
> forms are not allowed to be direct children of <tr>:
> 
>    <tr>
>        <form wicket:id="form">
>             <td>
> 
>    http://stackoverflow.com/questions/5967564/form-inside-a-table
> 
> After the first ajax request the browser will reshuffle the dom elements, so that the form is no longer the parent of the input field:
> 
>    <tr>
>                <form action="./?9-1.IFormSubmitListener-AddItemPanelEdit-form" method="post" id="form25" wicket:id="form"></form>
> 
>                <td>
>                    <input type="checkbox" id="onOff28" name="onOff" checked="checked" wicket:id="onOff">
> 
>                </td>
>    </tr>
> 
> Have fun
> Sven
> 
> 
> On 03.07.2015 00:23, Francois Meillet wrote:
>> Wicket version is 7.0.M6
>> 
>> 
>> Le 2 juil. 2015 à 23:47, Francois Meillet <fr...@gmail.com> a écrit :
>> 
>>> Description
>>> -----------------
>>> In the quickstart, the HomePage contains a form.
>>> 
>>> The form's model is a CompoundPropertyModel<>(new QuestionUnit(Boolean.TRUE));
>>> The QuestionUnit class has 2 properties, one is mandatory (string 'question').
>>> Properties use validation annotations.
>>> 
>>> The validation is done with javax.validation.Validator,
>>> so a call to BeanValidationConfiguration().configure(this) is done in the application init.
>>> 
>>> The form contains 2 formcomponents (1 TextField 'question' mandatory and 1 CheckBox 'onoff' ) + 1 FeedbackLabel (extends Label).
>>> If an error occurs when the form is submitted, a call from within the AjaxButton's onError method
>>> to the FormFieldEnlighter helper class is done.
>>> 
>>> The FormFieldEnlighter updates the FeedbackLabel's model's value,
>>> and add an AttributeModifier to the TextField to modify the 'title' attribute.
>>> Then the textfield and the feedbackLabel are resent via ajax.
>>> 
>>> When this form is submitted, for the first time, with nothing typed, an error occurs.
>>> Which is normal.
>>> The FeedbackLabel displays an error message.
>>> 
>>> If some characters are typed in the textfield and the form submitted again,
>>> the textfield is still invalid.
>>> Which is the problem.
>>> 
>>> But if, at the first submit with the error, the helper class FormFieldEnlighter does not resent the invalid textfield,
>>> the second submit works correctly, the form is valid and the ResultPage is displayed.
>>> 
>>> 
>>> 
>>> What I have found
>>> -----------------
>>> Looking at FormComponent - line 755
>>> List<StringValue> list = getRequest().getRequestParameters().getParameterValues(getInputName());
>>> list is null
>>> The textfield id is not in the parameters name.
>>> 
>>> 
>>> 
>>> environnement
>>> -------------
>>> mac osx / jdk 8 / safari & firefox
>>> 
>>> 
>>> Thanks for your help
>>> François
>>> 
>>> 
>>> <quickstart.zip>
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 


Re: problem submitting a form twice - quickstart joined

Posted by Sven Meier <sv...@meiers.net>.
Hi,

forms are not allowed to be direct children of <tr>:

     <tr>
         <form wicket:id="form">
              <td>

     http://stackoverflow.com/questions/5967564/form-inside-a-table

After the first ajax request the browser will reshuffle the dom 
elements, so that the form is no longer the parent of the input field:

     <tr>
                 <form 
action="./?9-1.IFormSubmitListener-AddItemPanelEdit-form" method="post" 
id="form25" wicket:id="form"></form>

                 <td>
                     <input type="checkbox" id="onOff28" name="onOff" 
checked="checked" wicket:id="onOff">

                 </td>
     </tr>

Have fun
Sven


On 03.07.2015 00:23, Francois Meillet wrote:
> Wicket version is 7.0.M6
>
>
> Le 2 juil. 2015 à 23:47, Francois Meillet <fr...@gmail.com> a écrit :
>
>> Description
>> -----------------
>> In the quickstart, the HomePage contains a form.
>>
>> The form's model is a CompoundPropertyModel<>(new QuestionUnit(Boolean.TRUE));
>> The QuestionUnit class has 2 properties, one is mandatory (string 'question').
>> Properties use validation annotations.
>>
>> The validation is done with javax.validation.Validator,
>> so a call to BeanValidationConfiguration().configure(this) is done in the application init.
>>
>> The form contains 2 formcomponents (1 TextField 'question' mandatory and 1 CheckBox 'onoff' ) + 1 FeedbackLabel (extends Label).
>> If an error occurs when the form is submitted, a call from within the AjaxButton's onError method
>> to the FormFieldEnlighter helper class is done.
>>
>> The FormFieldEnlighter updates the FeedbackLabel's model's value,
>> and add an AttributeModifier to the TextField to modify the 'title' attribute.
>> Then the textfield and the feedbackLabel are resent via ajax.
>>
>> When this form is submitted, for the first time, with nothing typed, an error occurs.
>> Which is normal.
>> The FeedbackLabel displays an error message.
>>
>> If some characters are typed in the textfield and the form submitted again,
>> the textfield is still invalid.
>> Which is the problem.
>>
>> But if, at the first submit with the error, the helper class FormFieldEnlighter does not resent the invalid textfield,
>> the second submit works correctly, the form is valid and the ResultPage is displayed.
>>
>>
>>
>> What I have found
>> -----------------
>> Looking at FormComponent - line 755
>> List<StringValue> list = getRequest().getRequestParameters().getParameterValues(getInputName());
>> list is null
>> The textfield id is not in the parameters name.
>>
>>
>>
>> environnement
>> -------------
>> mac osx / jdk 8 / safari & firefox
>>
>>
>> Thanks for your help
>> François
>>
>>
>> <quickstart.zip>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: problem submitting a form twice - quickstart joined

Posted by Francois Meillet <fr...@gmail.com>.
Wicket version is 7.0.M6


Le 2 juil. 2015 à 23:47, Francois Meillet <fr...@gmail.com> a écrit :

> Description
> -----------------
> In the quickstart, the HomePage contains a form.
> 
> The form's model is a CompoundPropertyModel<>(new QuestionUnit(Boolean.TRUE));
> The QuestionUnit class has 2 properties, one is mandatory (string 'question').
> Properties use validation annotations.
> 
> The validation is done with javax.validation.Validator, 
> so a call to BeanValidationConfiguration().configure(this) is done in the application init.
> 
> The form contains 2 formcomponents (1 TextField 'question' mandatory and 1 CheckBox 'onoff' ) + 1 FeedbackLabel (extends Label).
> If an error occurs when the form is submitted, a call from within the AjaxButton's onError method 
> to the FormFieldEnlighter helper class is done.
> 
> The FormFieldEnlighter updates the FeedbackLabel's model's value,
> and add an AttributeModifier to the TextField to modify the 'title' attribute.
> Then the textfield and the feedbackLabel are resent via ajax.
> 
> When this form is submitted, for the first time, with nothing typed, an error occurs.
> Which is normal.
> The FeedbackLabel displays an error message.
> 
> If some characters are typed in the textfield and the form submitted again,
> the textfield is still invalid.
> Which is the problem.
> 
> But if, at the first submit with the error, the helper class FormFieldEnlighter does not resent the invalid textfield, 
> the second submit works correctly, the form is valid and the ResultPage is displayed.
> 
> 
> 
> What I have found
> -----------------
> Looking at FormComponent - line 755 
> List<StringValue> list = getRequest().getRequestParameters().getParameterValues(getInputName());
> list is null
> The textfield id is not in the parameters name.
> 
> 
> 
> environnement
> -------------
> mac osx / jdk 8 / safari & firefox
> 
> 
> Thanks for your help
> François
> 
> 
> <quickstart.zip>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org