How to set merged field value with javascript

How do I set the value of a merged field with javascript? There is no SSI_SetValue function in the js library. I know I can do it with perl or an SSI system function, but I want to know how to do it in js.

I tried using the SSI function within my js (see below), but it appears that all SSI functions get evaluated regardless of the js logic. For example:


if(Age < 18)
{
[% setvalue(Cust,"first value") %];
}
else
{
[% setvalue(Cust,"second value") %];
}


In this example, Cust is always set to "second value". (Yes, I debugged with Firebug and confirmed that Age was < 18. The js logic is fine, but the SSI function setvalue is always evaluated (both of them).

Thanks in advance.

Resolved
1 reply