[pmwiki-users] Random PTVs set with {(randk)} do not retain set values

Hans Bracker design at softflow.co.uk
Tue Dec 16 16:22:44 CST 2014


Hello Luigi,

sorry,   got  your  pmwiki list message only now (something wrong with
the list server I suppose)

Sunday, December 14, 2014, 12:20:56 AM, you wrote:

> If I set a PTV to a random value with {(randk)}[1], say
>       Random_string: {(randk 7)}
> I then would like that specific PTV to retain its value.
> Instead,
>        {$:Random_string}
> gets every time a new random value.

if you write into the page:
Random_string: {(randk 7)}
then the PTV 'Random_string' always has the value '{(randk 7)}'
i.e.  the markup expression. And as you see, it changes each time you
open the page, or refresh it.

so  to have a random number  'fixed' as a PTV value, you would need to
post  it, for instance with Fox. So in the fox form you need something
like this:
(:input hidden $:Random_string="{$$(randk 7)}":)

Then  the  markup  expression  will  be  evaluated  when the form gets
processed, and assigned to the  Random_string PTV.

Or use in the fox form:
(:input hidden $:Random_string="{(randk 7)}":)

then  the  markup  expression  will  be  evaluated  when  th  epag eis
displayed, and on posting the value will be assigned to the PTV.

for  a  random  number  it  probably  does  not matter when th emarkup
expression  gets evaluated, at the time of form processing or th etime
of  page  display,  but  for  other expressions it may be crucial, for
instance to post a time stamp.

hope this helps!


Best,
 Hans                         




More information about the pmwiki-users mailing list