Home – New Forums Tech talk Website calculator? Reply To: Website calculator?

#1057564
RaspberryBlack
Member
  • Total posts: 47
Up
0
::

Assuming you want the days added when someone selects a date and then have it displayed in the same field that could look something like this:


[/CODE]

I marked the changes blue, so just some comments:
1: onSelect defines the event when the datepicker is selected
2: grabs the current date for the datepicker or null if no date has been selected
3: checks if date is something else than null
4: date is set to date + x days
5: sets the datepicker field to new date; maybe you want to do something else here e.g. just displaying it next to the datepicker field. Otherwise this behaviour could be irritating for users.[CODE]

[/CODE]

I marked the changes blue, so just some comments:
1: onSelect defines the event when the datepicker is selected
2: grabs the current date for the datepicker or null if no date has been selected
3: checks if date is something else than null
4: date is set to date + x days
5: sets the datepicker field to new date; maybe you want to do something else here e.g. just displaying it next to the datepicker field. Otherwise this behaviour could be irritating for users.