Grails make one g:datePicker depend on other g:datePicker -
imagine have index.gsp 2 dates: starting day , ending day.
when user picks starting day, how can calculate + 2 months in ending day?
i know in controller have like:
use (timecategory) { c = new date() + 2.month }
but how best way change ending day in gsp? remotefunction?
edit: yes worked, thank lukelazarovic.
like said thing needed change last line, changed to: $("#myid_month").val(month+3);
function datewaschanged(){ .... $("#myid_month").val(month+3); }
edit2: needed increment year, reason strings remember do: myinteger = parseint(mystring);
i assume want on client - without reloading page +2 months date set end date datepicker.
that means have using javascript or javascript-based framework (jquery).
you can go along solution suggested in question: get date value grails datepicker change set value of end datepicker on last line of function datewaschanged this:
$("#enddatepickerid").datpicker("setdate", date);
Comments
Post a Comment