You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Raffek <ra...@gmail.com> on 2009/05/06 23:22:01 UTC
Struts 2.1.6 ajax submit with datetimepicker
Hi guys.
I faced such a problem today. I have created jsp, which looks like this:
//////////////file.jsp//////////////////////////////
...
//////////////struts.xml/////////////////////////////
/pages/actions/pracuj/niemaczasu.jsp
pracujKolejna
////////////////action.actions.pracuj.niemaczasu(class)/////////////////
private Date kolejnaProbaDate;
public String execute() throws Exception
{
System.out.println(kolejnaProbaDate.toString());
return super.execute();
}
public DategetKolejnaProbaDate() {
return kolejnaProbaDate;
}
public void setKolejnaProbaDate(Date kolejnaProbaDate) {
this.kolejnaProbaDate = kolejnaProbaDate;
}
////////////// validation file///////////////////////////
The field is required.
This configuration works - value is passed to class and is validated
properly with all static fields( and i have also tested it with tag and
worked properly.
The problem is that i get back the JSON String properly, while
validating(from firebug):
/* { "fieldErrors": {"kolejnaProbaDate":["The field is
required."],"kolejnaProbaTime":["Pole musi byc data
."]}} */
Second thing is that when i choose values from datetimepicker and click
submit, i am still getting validation errors.
When i turn off ajax validation, i find null values in action.
I will appreciate any help, because i run out of ideas. Maybe someone faced
similar problem?
--
View this message in context: http://www.nabble.com/Struts-2.1.6-ajax-submit-with-datetimepicker-tp23415768p23415768.html
Sent from the Struts - User mailing list archive at Nabble.com.
Re: Struts 2.1.6 ajax submit with datetimepicker
Posted by Raffek <ra...@gmail.com>.
Raffek wrote:
>
> Hi guys.
> I faced such a problem today. I have created jsp, which looks like this:
>
> //////////////file.jsp//////////////////////////////
> <sx:header debug="true" />
> ...
> <s:form action="niemaczasu" namespace="/nodecorate" theme="xhtml"
> id="niemaczasu_form">
> <sx:datetimepicker required="true" label="Data" labelposition="left"
> name="kolejnaProbaDate" type="date" displayFormat="dd/MM/yyyy"
> weekStartsOn="0" id="kolejnaProbaDate"></sx:datetimepicker>
>
> <sx:submit validate="true" ajaxAfterValidation="true"
> id="niemaczasu_submit"
> indicator="indicator_main" formId="niemaczasu_form" value="Dalej"
> targets="main"></sx:submit>
>
> </s:form>
>
> //////////////struts.xml/////////////////////////////
> <action name="niemaczasu" class="action.actions.pracuj.niemaczasu">
> <interceptor-ref name="jsonValidationWorkflowStack" />
> <result name="input">
> /pages/actions/pracuj/niemaczasu.jsp
> </result>
> <result type="redirectAction">
> pracujKolejna
> </result>
> </action>
> ////////////////action.actions.pracuj.niemaczasu(class)/////////////////
>
> private Date kolejnaProbaDate;
>
> public String execute() throws Exception
> {
> System.out.println(kolejnaProbaDate.toString());
> return super.execute();
> }
>
> public DategetKolejnaProbaDate() {
> return kolejnaProbaDate;
> }
> public void setKolejnaProbaDate(Date kolejnaProbaDate) {
> this.kolejnaProbaDate = kolejnaProbaDate;
> }
> ////////////// validation file///////////////////////////
> <validators>
> <field name="kolejnaProbaDate">
> <field-validator type="requiredstring">
> <message>The field is required.</message>
> </field-validator>
> </field>
> </validators>
>
> This configuration works - value is passed to class and is validated
> properly with all static fields( <s:textfield> <s:textarea> and i have
> also tested it with <sx:autocompleter> tag and worked properly.
>
> The problem is that i get back the JSON String properly, while
> validating(from firebug):
> /* { "fieldErrors": {"kolejnaProbaDate":["The field is
> required."],"kolejnaProbaTime":["Pole musi byc data
> ."]}} */
>
> And after that field should be highlighted and error message should
> appear, but none of that happens...
>
> Second thing is that when i choose values from datetimepicker and click
> submit, i am still getting validation errors.
> When i turn off ajax validation, i find null values in action.
>
> I will appreciate any help, because i run out of ideas. Maybe someone
> faced similar problem?
>
--
View this message in context: http://www.nabble.com/Struts-2.1.6-ajax-submit-with-datetimepicker-tp23415768p23417373.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Struts 2.1.6 ajax submit with datetimepicker
Posted by Raffek <ra...@gmail.com>.
solved - i didnt added @Override annotation on execute() method in the class.
--
View this message in context: http://www.nabble.com/Struts-2.1.6-ajax-submit-with-datetimepicker-tp23415768p23425673.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org