Oh, I think that the validation step is doing the right thing in ignoring
those fields. It's the __fp field that's only getting the main
<stripes:form> tag's info, rather than including the nested <stripes:form
partial="true"> tags' values that I think is not doing the right thing.
So to make it clearer, let's say you have a wizard layout that looks like
this:
<stripes:form action="${actionBean.wizardAction}">
<ul class="wizardMenu">
<c:forEach var="wizardPage" items="${actionBean.wizardPages}"
varStatus="status">
<li><stripes:submit name="${wizardPage.targetAction}">
<fmt:message key="${wizardPage.label}"/></stripes:submit></li>
</c:forEach>
</ul>
<stripes:text name="myObject.requiredField"/>
</stripes:form>
then that works fine, because the form tag goes through, registers the
"myObject.requiredField" tag in the fieldsPresent ("__fp"), and so on
submit the validator knows that that field is present on the page and
should be checked if it's required.
Meanwhile, if instead of including the <stripes:text> field directly, you
instead go
<jsp:include page="/WEB-INF/jsp/fields/myFields.jsp"/>
which includes
<stripes:form action="${actionBean.wizardAction}" partial="true">
<stripes:text name="myObject.requiredField"/>
</stripes:form>
...then suddenly the nested form tag doesn't write out any __fp fields.
And the parent form tag doesn't write it out, either. So the fact that the
"myObject.requiredField" tag is in the form is lost. And so the validator,
since this is a wizard, just thinks that the field must be referenced in
some other page of the wizard, and so doesn't mark it as being required.
I just put in a bit of code in FormTag.java that saves the fieldsPresent
values in a partial form tag and then prints it on the parent. It seems to
work ok for me, though there might be some other problems there that I
haven't thought of yet.
-allen
On Mon, Jun 29, 2009, 15:59, Mike McNally <[email protected]> wrote
>How would the validator know that the incoming parameters are from the
>same page? All it sees is the set of parameters in the HTTP request,
>and it uses the validation metadata for the action bean & event as
>appropriate.
>
>(In other words - validation works whether you post from a Stripes page or
not.)
>
>Maybe I'm missing what you mean by "noted as being required".
>
>
>On Mon, Jun 29, 2009 at 2:50 PM, allen petersen<[email protected]> wrote:
>> Hi.
>>
>> So, quick version: �stripes wizard form with a nested page that has a
>> <stripes:form partial="true"> tag in it. �Required fields are included
in
>> the nested partial form tag. �But...those required fields aren't being
>> noted as being required, because the __fp (fieldsOnPage) field is only
>> being written for the top-level form tag. �So the validator thinks that
the
>> fields are from another page, and therefore don't need to be validated
as
>> required.
>>
>> I think I can work around this (or file a bug and submit a patch or
>> whatever), but I just wanted to run this by the list and see if there
was a
>> known easy fix/workaround. �Or if I'm just doing something wrong.
�(Well,
>> other than using a nested partial form in the first place; I'm actually
>> having to use the 1.5.2 beta branch already in order to get around
another
>> bug there....)
>>
>> -allen
>>
>>
>>
---------------------------------------------------------------------------
---
>> _______________________________________________
>> Stripes-users mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/stripes-users
>>
>
>
>
>--
>Turtle, turtle, on the ground,
>Pink and shiny, turn around.
>
>--------------------------------------------------------------------------
----
>_______________________________________________
>Stripes-users mailing list
>[email protected]
>https://lists.sourceforge.net/lists/listinfo/stripes-users
>
>
------------------------------------------------------------------------------
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users