function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
pq100pq100 

button to add weeks to inputfield date

Hi

 

I've got a visualforce page with a number of inputfields showing various dates, alongside them i have commandbuttons and another empty input field. I'd like the user to be able to type in a number of weeks into the empty box, click the button which will then automatically add the number of weeks to the date field. 

 

I'm pretty new to this, any ideas how i should go about it?

 

Thanks

Paul

Darshan FarswanDarshan Farswan

You can define a action funtion for the Command Button that performs the desired functionality.

The definition should go as

 

public PageReference addweeks() {
date_field = date_field.adddays(no_of_weeks*7);
return null;
}

 

The command must call this function whenever it is clicked.