Home : Products : Gossamer Links : Development, Plugins and Globals :

Products: Gossamer Links: Development, Plugins and Globals: Re: [VishalT] How to do this: Add multiple unique randomized hidden fields from desired range: Edit Log

Here is the list of edits for this post
Re: [VishalT] How to do this: Add multiple unique randomized hidden fields from desired range
Hi Vishal,

I am not sure what exactly is your task but given I understand you right you cold add a global e.g. rand_31 with:

Code:
sub {
my @array = ( 1 .. 31 );
use List::Util qw(shuffle);
@array = shuffle(@array);
return @array;
}

and in the templates call the sub and loop through it.
Not 100% sure if you can return an array to the templats or if you have to

Code:
sub {
my @array = ( 1 .. 31 );
use List::Util qw(shuffle);
@array = shuffle(@array);
return \@array;
}

Regards

Niko

Last edited by:

el noe: Apr 3, 2020, 12:34 AM

Edit Log: