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-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org