I have a single line field in the modern design form version 12. I'd like the customer to be able to insert a clickable link. Is this possible? I've added a blank custom HTML under the single line field and found this for the js but it is not working.
LFForm.onFieldChange(function () {
let url = this.value.trim();
let html = "";
if (url) {
// Ensure URL is valid for hyperlinking
if (!url.startsWith("http://") && !url.startsWith("https://")) {
url = "http://" + url;
}
html = `<a href="${url}" target="_blank">${url}</a>`;
}
// Inject the clickable link into the HTML field
LFForm.changeFieldSettings(
{ variableName: "UrlClickable" },
{ content: html }
);
}, { variableName: "UrlInput" });
The instructions said to name the variable for the custom HTML "UrlClickable" but I do not see any variable for that field.
Should I just make the form in classic design?