You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Christopher Maloof <C_...@mail.jci.tju.edu> on 2009/02/02 17:06:31 UTC
clearing errors and input fields after Ajax validation in 2.1.6
Hello,
I've just installed Struts 2.1.6, and I'm converting a form to use Ajax
validation. It's mostly working nicely, except that the input fields
and errors don't clear after a submission. (Ideally, errors should
always clear, and input fields should clear if validation succeeds.)
The errors show up properly; they just don't go away when the user tries
submitting again.
Is there some parameter I haven't found that will make this work, or do
I need to set things up differently? Everything else works so smoothly,
I hope maybe I'm just missing something small... relevant snippets of
code below.
Thanks,
Chris
[researchers.jsp]
<head>
<sx:head/>
</head>
<!-- This is the form that gets validated -->
<s:form action="addResearcher">
<table>
<s:textfield name="name" label="Name" />
<s:textfield name="email" label="E-mail" />
</table>
<sx:submit value="Add researcher" align="left" validate="true"
ajaxAfterValidation="true" targets="researcherlist" id="add_submit" />
</s:form>
<!-- Produce a table with the current list of researchers -->
<s:url id="researcherTableURL" action="researcherTable" />
<sx:div href="%{#researcherTableURL}" id="researcherlist" preload="true"
loadingText="Loading researchers...">
</sx:div>
[struts.xml]
<action name="addResearcher" class="mypackage.ResearcherTable"
method="addResearcher">
<result>/jsp/ajax/researcherTable.jsp</result>
<interceptor-ref name="jsonValidationWorkflowStack"/>
</action>
<action name="researcherTable" class="mypackage.ResearcherTable">
<result>/jsp/ajax/researcherTable.jsp</result>
</action>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: clearing errors and input fields after Ajax validation in 2.1.6
Posted by Musachy Barroso <mu...@gmail.com>.
Yeah, that's a good idea, you will find that under "Validation" (menu)
-> Validation (ajax).
musachy
On Mon, Feb 2, 2009 at 11:22 AM, Christopher Maloof
<C_...@mail.jci.tju.edu> wrote:
> The Firefox error console doesn't show any problems. I haven't tried this
> showcase app (I'm pretty new to the framework) -- I guess I'll take a look
> and see if I can pin down any differences?
>
> Chris
>
> On 2/2/2009 11:14 AM, Musachy Barroso wrote:
>>
>> I just tried in showcase and they get cleared, is there any javascript
>> error on the page?
>>
>> musachy
>>
>> On Mon, Feb 2, 2009 at 11:06 AM, Christopher Maloof
>> <C_...@mail.jci.tju.edu> wrote:
>>
>>>
>>> Hello,
>>>
>>> I've just installed Struts 2.1.6, and I'm converting a form to use Ajax
>>> validation. It's mostly working nicely, except that the input fields and
>>> errors don't clear after a submission. (Ideally, errors should always
>>> clear, and input fields should clear if validation succeeds.) The errors
>>> show up properly; they just don't go away when the user tries submitting
>>> again.
>>>
>>> Is there some parameter I haven't found that will make this work, or do I
>>> need to set things up differently? Everything else works so smoothly, I
>>> hope maybe I'm just missing something small... relevant snippets of code
>>> below.
>>>
>>> Thanks,
>>> Chris
>>>
>>> [researchers.jsp]
>>>
>>> <head>
>>> <sx:head/>
>>> </head>
>>>
>>> <!-- This is the form that gets validated -->
>>> <s:form action="addResearcher">
>>> <table>
>>> <s:textfield name="name" label="Name" />
>>> <s:textfield name="email" label="E-mail" />
>>> </table>
>>> <sx:submit value="Add researcher" align="left" validate="true"
>>> ajaxAfterValidation="true" targets="researcherlist" id="add_submit" />
>>> </s:form>
>>>
>>>
>>> <!-- Produce a table with the current list of researchers -->
>>> <s:url id="researcherTableURL" action="researcherTable" />
>>> <sx:div href="%{#researcherTableURL}" id="researcherlist" preload="true"
>>> loadingText="Loading researchers...">
>>> </sx:div>
>>>
>>>
>>> [struts.xml]
>>> <action name="addResearcher" class="mypackage.ResearcherTable"
>>> method="addResearcher">
>>> <result>/jsp/ajax/researcherTable.jsp</result>
>>> <interceptor-ref name="jsonValidationWorkflowStack"/>
>>> </action>
>>>
>>> <action name="researcherTable" class="mypackage.ResearcherTable">
>>> <result>/jsp/ajax/researcherTable.jsp</result>
>>> </action>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>> For additional commands, e-mail: user-help@struts.apache.org
>>>
>>>
>>>
>>
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
--
"Hey you! Would you help me to carry the stone?" Pink Floyd
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: clearing errors and input fields after Ajax validation in 2.1.6
Posted by Christopher Maloof <C_...@mail.jci.tju.edu>.
The Firefox error console doesn't show any problems. I haven't tried
this showcase app (I'm pretty new to the framework) -- I guess I'll take
a look and see if I can pin down any differences?
Chris
On 2/2/2009 11:14 AM, Musachy Barroso wrote:
> I just tried in showcase and they get cleared, is there any javascript
> error on the page?
>
> musachy
>
> On Mon, Feb 2, 2009 at 11:06 AM, Christopher Maloof
> <C_...@mail.jci.tju.edu> wrote:
>
>> Hello,
>>
>> I've just installed Struts 2.1.6, and I'm converting a form to use Ajax
>> validation. It's mostly working nicely, except that the input fields and
>> errors don't clear after a submission. (Ideally, errors should always
>> clear, and input fields should clear if validation succeeds.) The errors
>> show up properly; they just don't go away when the user tries submitting
>> again.
>>
>> Is there some parameter I haven't found that will make this work, or do I
>> need to set things up differently? Everything else works so smoothly, I
>> hope maybe I'm just missing something small... relevant snippets of code
>> below.
>>
>> Thanks,
>> Chris
>>
>> [researchers.jsp]
>>
>> <head>
>> <sx:head/>
>> </head>
>>
>> <!-- This is the form that gets validated -->
>> <s:form action="addResearcher">
>> <table>
>> <s:textfield name="name" label="Name" />
>> <s:textfield name="email" label="E-mail" />
>> </table>
>> <sx:submit value="Add researcher" align="left" validate="true"
>> ajaxAfterValidation="true" targets="researcherlist" id="add_submit" />
>> </s:form>
>>
>>
>> <!-- Produce a table with the current list of researchers -->
>> <s:url id="researcherTableURL" action="researcherTable" />
>> <sx:div href="%{#researcherTableURL}" id="researcherlist" preload="true"
>> loadingText="Loading researchers...">
>> </sx:div>
>>
>>
>> [struts.xml]
>> <action name="addResearcher" class="mypackage.ResearcherTable"
>> method="addResearcher">
>> <result>/jsp/ajax/researcherTable.jsp</result>
>> <interceptor-ref name="jsonValidationWorkflowStack"/>
>> </action>
>>
>> <action name="researcherTable" class="mypackage.ResearcherTable">
>> <result>/jsp/ajax/researcherTable.jsp</result>
>> </action>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>>
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: clearing errors and input fields after Ajax validation in 2.1.6
Posted by Musachy Barroso <mu...@gmail.com>.
I just tried in showcase and they get cleared, is there any javascript
error on the page?
musachy
On Mon, Feb 2, 2009 at 11:06 AM, Christopher Maloof
<C_...@mail.jci.tju.edu> wrote:
> Hello,
>
> I've just installed Struts 2.1.6, and I'm converting a form to use Ajax
> validation. It's mostly working nicely, except that the input fields and
> errors don't clear after a submission. (Ideally, errors should always
> clear, and input fields should clear if validation succeeds.) The errors
> show up properly; they just don't go away when the user tries submitting
> again.
>
> Is there some parameter I haven't found that will make this work, or do I
> need to set things up differently? Everything else works so smoothly, I
> hope maybe I'm just missing something small... relevant snippets of code
> below.
>
> Thanks,
> Chris
>
> [researchers.jsp]
>
> <head>
> <sx:head/>
> </head>
>
> <!-- This is the form that gets validated -->
> <s:form action="addResearcher">
> <table>
> <s:textfield name="name" label="Name" />
> <s:textfield name="email" label="E-mail" />
> </table>
> <sx:submit value="Add researcher" align="left" validate="true"
> ajaxAfterValidation="true" targets="researcherlist" id="add_submit" />
> </s:form>
>
>
> <!-- Produce a table with the current list of researchers -->
> <s:url id="researcherTableURL" action="researcherTable" />
> <sx:div href="%{#researcherTableURL}" id="researcherlist" preload="true"
> loadingText="Loading researchers...">
> </sx:div>
>
>
> [struts.xml]
> <action name="addResearcher" class="mypackage.ResearcherTable"
> method="addResearcher">
> <result>/jsp/ajax/researcherTable.jsp</result>
> <interceptor-ref name="jsonValidationWorkflowStack"/>
> </action>
>
> <action name="researcherTable" class="mypackage.ResearcherTable">
> <result>/jsp/ajax/researcherTable.jsp</result>
> </action>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
--
"Hey you! Would you help me to carry the stone?" Pink Floyd
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: clearing errors and input fields after Ajax validation in 2.1.6
Posted by Dave Newton <ne...@yahoo.com>.
Christopher Maloof wrote:
> Solved; it turns out that the <table> tags in the form were somehow
> causing this problem.
Yeah, the S2 form tags put everything in a table by default, so you
would have had some funky HTML there... different browsers handle
malformed HTML in different ways. Yay browsers.
Dave
>> [researchers.jsp]
>>
>> <head>
>> <sx:head/>
>> </head>
>>
>> <!-- This is the form that gets validated -->
>> <s:form action="addResearcher">
>> <table>
>> <s:textfield name="name" label="Name" />
>> <s:textfield name="email" label="E-mail" />
>> </table>
>> <sx:submit value="Add researcher" align="left" validate="true"
>> ajaxAfterValidation="true" targets="researcherlist" id="add_submit" />
>> </s:form>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: clearing errors and input fields after Ajax validation in 2.1.6
Posted by Christopher Maloof <C_...@mail.jci.tju.edu>.
Solved; it turns out that the <table> tags in the form were somehow
causing this problem.
Chris
On 2/2/2009 11:06 AM, Christopher Maloof wrote:
> Hello,
>
> I've just installed Struts 2.1.6, and I'm converting a form to use
> Ajax validation. It's mostly working nicely, except that the input
> fields and errors don't clear after a submission. (Ideally, errors
> should always clear, and input fields should clear if validation
> succeeds.) The errors show up properly; they just don't go away when
> the user tries submitting again.
>
> Is there some parameter I haven't found that will make this work, or
> do I need to set things up differently? Everything else works so
> smoothly, I hope maybe I'm just missing something small... relevant
> snippets of code below.
>
> Thanks,
> Chris
>
> [researchers.jsp]
>
> <head>
> <sx:head/>
> </head>
>
> <!-- This is the form that gets validated -->
> <s:form action="addResearcher">
> <table>
> <s:textfield name="name" label="Name" />
> <s:textfield name="email" label="E-mail" />
> </table>
> <sx:submit value="Add researcher" align="left" validate="true"
> ajaxAfterValidation="true" targets="researcherlist" id="add_submit" />
> </s:form>
>
>
> <!-- Produce a table with the current list of researchers -->
> <s:url id="researcherTableURL" action="researcherTable" />
> <sx:div href="%{#researcherTableURL}" id="researcherlist"
> preload="true" loadingText="Loading researchers...">
> </sx:div>
>
>
> [struts.xml]
> <action name="addResearcher" class="mypackage.ResearcherTable"
> method="addResearcher">
> <result>/jsp/ajax/researcherTable.jsp</result>
> <interceptor-ref name="jsonValidationWorkflowStack"/>
> </action>
>
> <action name="researcherTable" class="mypackage.ResearcherTable">
> <result>/jsp/ajax/researcherTable.jsp</result>
> </action>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org