Page 1 of 1
dropdown list for year selection
Posted: Thu Jun 13, 2019 11:19 pm
by kleung
Hi,
I would like to use a dropdown list for users to select a year. Instead of hard code a wide range of years, would be it possible to use Javascript to build the years in the options, e.g. from 1990 to current year, for user selection?
Many Thanks
cheers,
Karl
Re: dropdown list for year selection
Posted: Fri Jun 14, 2019 6:42 pm
by amosbatto
Add this trigger to the process:
Code: Select all@=aYears = [];
$year = 1990;
while ($year <= date('Y')) {
@=aYears[] = [$year, $year];
$year++;
}
Set this trigger to fire
before the Dynaform holding the dropdown box.
Then, in the properties of the dropdown in the Dynaform, set the
datasource property to "array variable" and set the
data variable property to: @@aYears
Re: dropdown list for year selection
Posted: Sat Jun 15, 2019 5:43 am
by kleung
Hi Amos,
The $aYears could be assigned with the desired values.
But the values could not be shown in the dropdown list, i.e. all the contents are blanks. I also note that the values in the labels were converted to strings.
How to fix it?
Many Thx
cheers,
Karl
Re: dropdown list for year selection
Posted: Sun Jun 16, 2019 10:35 am
by kleung
Hi Amos,
problem fixed.
The field variable and the data variable should not be the same.
Then the problem solved.
Many thx
cheers,
Karl