Hallo everyone!


I'm starting to be desperate about DateField component. In my case, this 
component works only for default format settings, other format makes it 
unusable and buggy. 

This is basic example I've tried without success:





<t:form>

  <t:datefield t:id="myDateField" t:value="myDate" t:format="yyyy-MM-dd"/>

  <t:submit t:id="submit" value="Set The Date" />

</t:form>




-The value is viewed correctly (e.g. 2013-12-05), but when I clict some 
value from visual calendar, it is placed into textfied in default format ( 
12/05/2013) and error occures when you tried to submit value, as it can't be
parsed by specified yyyy-MM-dd format.




I've tried to customize datefield by CustomDatepicker mixin, so I've added 
params getter method into my page class:


public JSONObject getParams() {

  return new JSONObject("dateFormat", "yy-mm-dd");

}





and adjust template regardingly:




<t:datefield t:id="myDateField" t:value="myDate" t:format="yyyy-MM-dd" t:
mixins="jquery/CustomDatepicker" t:params="params"/> 





This makes it slightly better. Value picked in calendar popup is placed in 
textfield in correct format. BUT, textfield value disapears when it is 
submited! When I inspect the code in Chrome, I can see that value attribute 
is filled as it should be:




<input value="2013-12-05" id="myDateField" name="myDateField" type="text" 
class="hasDatepicker">





but the value is simply missing in textfield rendered on page.

I've tried also to modify code in DateField class directly and interested 
thing is, that when I write second input tag, completely same as original 
one (sure, same id and name is wrong, but just for try) with writer.elemet(.
..), the second input shows the value correctly (it just doesn't have class=
"hasDatepicker" attribute set).




Documentation says about ajax validation, but I can't see (or maybe can't 
detect) any ajax calls. Should I set or configure something special?

I'm using Tapestry 5.3.7. I have set "SUPPRESS_PROTOTYPE" to "true".





I would be glad for any hint how to get it work, or tutorial how to get 
other datepicker component (able to handle different date formats) to work 
in Tapestry. 

Best regards

Ladislav

Reply via email to