You are viewing limited content. For full access, please sign in.

Question

Question

Forms 11 JavaScript interferes with Rules

asked on January 6, 2023 Show version history

I just installed Forms 11 Update 3 today and got started testing my Classic JavaScript code in the Modern version of the form. Unfortunately, it looks like having any JavaScript present in the form causes the field and lookup rules I've created to be ignored. Once I start making selections the field rules start working on their respective show/hide fields, but the lookups never work. I even tried the simple page load script below. Is there something I need to add to allow the modern rules to work normally again?

$(document).ready(function(){
});

Browser console errors:

2 0

Answer

SELECTED ANSWER
replied on January 10, 2023

Hi Jonathan,

The custom JavaScript developed for classic form would not work for modern form; the underlying architecture is different so there is no chance to make old script work on the new form. 

However I don't think it should fail the rules when custom script has errors; I have reported it as a bug.

Sorry for the inconvenience.

1 0

Replies

replied on January 9, 2023

The self-hosted documentation is expected to be available this week. The Cloud documentation should prepare you for what's to come though: The LFForm Object (laserfiche.com)

2 0
replied on January 9, 2023

Thank you! I'll start looking over the documentation and videos published for Cloud. It's certainly different from the little JavaScript code I had played with before upgrading to LF11 and started building in Modern.

0 0
replied on January 9, 2023

Any updates? Did your classic forms work fine if you left them in classic? This was just you trying to convert them to the new designer, correct. I'm not sure I'd be ready to do that. But I certainly am excited to update and design new processes with update 3.

0 0
replied on January 9, 2023

That's correct. I converted to Modern from Classic months ago and this was a feature I was missing. Luckily, I found that the first task I was attempting to script, setting the minimum date selection to Today, is available through the rules with this latest update.

 

I almost deleted this post, but I'm curious whether I'm alone with this issue or if it's common with the latest update.

0 0
replied on January 9, 2023 Show version history

The "$ is not defined" message makes it seem like jQuery is not loaded.

The new designer may not reference jQuery like the classic designer, in which case it would have to be loaded first.

Try using native javascript code to see if that works and that should rule out issues with javascript as a whole.

document.addEventListener("DOMContentLoaded", function(event) { 
  console.log('JavaScript is working');
});

 

0 0
replied on January 9, 2023

Jason have you updated?

0 0
replied on January 9, 2023

We have not updated yet. We have quite a few critical and very high-volume processes running in Forms so we usually don't upgrade until at least a few months after an update has been released.

2 0
replied on January 9, 2023

@████████I tried your code and it resolves the first error, but the second error is still there. But it's a start!

document.addEventListener("DOMContentLoaded", function(event) { 
  console.log('JavaScript is working');
});

49 Unchecked runtime.lastError: The message port closed before a response was received.

0 0
replied on July 19, 2023

Hi, This bug has been fixed on Forms 11 Update 4.

You can see other changes from:

List of Changes for Laserfiche Forms 11 Update 4 - Knowledge Base

Get Forms 11 Update 4 from Laserfiche 11 package:

Software versions and fixes included in the Laserfiche 11 Download Package - Knowledge Base

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.