javawebtapestrydatefield

how to disable past date in tapx-datefield


hi im using tapx datefield date picker in my tapestry project, and i want to disable past dates so user cannot select past dates, how can i do that, i have tried several method and discover that tapx-datefield has max and min parameter inside its class, but i have no idea how to set it. can anybody help me with this ? thanks for any help

this is the parameter i said above


Solution

  • Component parameters can be passed via attributes, i.e. <t:DateField max="myMaxDate" min="myMinDate" ... /> , thanks to Dimitry Gusev comment, so you just have to create a date variable and pass it ..... for example

    Date td = new Date();
        Calendar c = Calendar.getInstance();
        c.setTime(td);
        c.add(Calendar.DATE, 1);
        td = c.getTime(); //TODO> Tomorrow Date 
    
    maxDate = td;