[
https://issues.apache.org/jira/browse/WICKET-6375?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16027613#comment-16027613
]
Martin Grigorov commented on WICKET-6375:
-----------------------------------------
Here is what happens here:
The label is properly set to the TextField during the rendering of the
stateless page at
org.apache.wicket.markup.html.form.AutoLabelTextResolver.TextLabel#onComponentTagBody().
But the form submit creates a new page instance (because it is stateless) and
thus a completely new TextField instance which still has no custom label and
the error feedback message uses the default form component label - its
component id.
I'll try to make getLabel() as lazy as possible.
> FormComponent label model not populated from markup in stateless page
> ---------------------------------------------------------------------
>
> Key: WICKET-6375
> URL: https://issues.apache.org/jira/browse/WICKET-6375
> Project: Wicket
> Issue Type: Bug
> Affects Versions: 7.7.0, 8.0.0-M6
> Reporter: Daniel Radünz
> Assignee: Martin Grigorov
> Priority: Minor
> Attachments: quickstart_wicket-6375.zip
>
>
> Using following HTML markup to populate the label model of a FormComponent
> doesn't seem to work properly on stateless pages
> {code:java}
> <label wicket:for="wicketidinput"><wicket:label>Label</wicket:label>:</label>
> <input wicket:id="wicketidinput">
> {code}
> The attached quickstart contains a homepage leading to two pages.
> * StatefulFormPage: Submitting the form without entering something in the
> required TextField results in the error message "'Label' is required"
> ** The label model is correctly populated with the word "Label" from the
> markup file
> * StatelessFormPage: Submitting the form without entering something in the
> required TextField results in the error message "'wicketidinput' is required"
> ** The label model seemingly is not populated, resulting in wicket falling
> back to using the wicket Id "wicketidinput" as label model object
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)