Hi Olivier,
"Pure" javascript doesn't work in the new forms designer. It not broken - it's by design. You need to use the LFForm object. LFForm object info here
I have scripted something like this before. This code block fires after the lookup event. The event number of the lookup is shown in your lookup rules (e.g 1 or 2 or 3...whichever number it is).
LFForm.onLookupDone(function () {
var link = LFForm.getFieldValues({fieldId: 12});
console.log(link);
LFForm.changeFieldSettings(
{ fieldId: 15 },
{ content: "<a href='"+link+"' target=\"_blank\" class=\"GFG\">Click Here to Make A Secure Payment</a>" }
//{ content: "<form action='"+link+"'><input type=\"submit\" value=\"Go to Google\"></form>" }
);
}, {lookupRuleId: 1}); // after lookup rule 1 is done
After the lookup is done (rule 1) this event fires.
In this particular code block, I am creating a link from a field (#12)
After I get that link I put it into a variable ("link"), the next step is to change the field settings of my html field (which changes the content of the html field.
My html field is id # 15 and the "changeFieldSettings" event changes my html field.
I edited this down from a larger function so hopefully I cleaned it up enough.