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

Discussion

Discussion

Forms 11 - Javascript

posted on October 6, 2021

We recently upgrades to 11 and I was looking forward to using the new forms interface but noticed there is no way to use JavaScript.  Most of our forms have some JavaScript in them.  With this being the case I have to use the classic version and cannot take advantage of the new version.

Are you able to provide an update as it if/when the new forms interface will have java?

0 0
replied on March 16

Thank you Houng. Now I understand the why. Very well explained.

Are there plans to have a way for us end users to request customizations to the LFForm object?

For ex: Currently I am trying to get the multiline object to expand without scroll bars; so that, when the form is saved as a PDF the entire entry will be available for viewing. 

0 0
replied on January 12 Show version history
0 0
replied on March 15

It looks like jQuery is not available in the new designer. Is that right? 

0 0
replied on March 15

Not by default.

Via the "External" tab you can add the JQuery libraries, including the ones that are already installed for Forms.

But bear in mind that any Javascript you add to the new designer, including anything you add on the "External" tab, runs within a sandboxed iFrame, so it doesn't have direct access to the form, fields, window, or document.  Even if you add JQuery, you'll still be limited to changes on the form that are available through the LFForm interface.

2 0
replied on March 15

What is Laserfiche's reasoning to using the iFrame and keeping us from direct access to the form, fields, window and document?

Why not have the same functionality as in the classic designer. Seems like that's going backward.

Would be nice to understand.

 

0 0
replied on March 15

Hello,

There are 2 main reasons for putting custom scripts in sandbox iframes and limiting changes to what LFForm offers:

1. Allowing direct access to the DOM opens Forms up to security vulnerabilities. Having direct access to the DOM means you also have access to all cookies and local storage. If you are under an XSS attack or you open a form with malicious code, your credentials can be used to call APIs to do unwanted things, like deleting processes or updating security roles. 

2. Classic form uses the DOM as the source of truth, so you can directly modify things on the DOM and they will stick. New form uses Angular with an internal source of truth. So unless you modify this source of truth, Angular will overwrite any changes you make on the DOM. You can only modify this source of truth through the LFForm API.

We understand that these restrictions to scripting in new form make it harder to do what you did with scripting in classic form. We are constantly collecting information on scripting use cases and will expand the LFForm API to accomodate them. We will also update the documentation to help ease migration through more concrete examples. 
Last but not least, as a sneak peak, we are working on a new feature that lets you define your own field on the form. You will have full access to your custom field for scripting purpose.

5 0
replied on March 16

Huong, if it helps your team the thing I most often have to use JavaScript for is date calculations, taking a date or set of dates from fields on the form, using the JavaScript Date objects to do things the Advanced Formula can't do, and then putting a value into a field or values into a drop down. 

The other thing I have to use JavaScript for is to create tables with a 'select row' checkbox. This is where the lack of jQuery hurts, because I need to use the jQuery element selectors to get at the 'Select Row' checkboxes in a table. 

0 0
replied on March 16

Thank you @████████- I suspected that was the reasoning, but it is nice to have confirmation from Laserfiche regarding it.  I agree that it is a really good reason to restrict it - especially for publicly available forms.  Personally, I'm finding myself using the New Designer most with public facing forms that I want to look and feel nice on any browser, but don't need really complex functionality.  But there are definitely some areas where the LFForm interface needs to be expanded.  

Meanwhile, I continue to use the classic designer almost exclusively for internal forms for staff, which often need additional or more complex functionality.  Especially since I'm making use of API calls and other really complex stuff.

Also, I am really wishing the new Field Rule functionalities that came with 11 Update 3 were included in both designers instead of just the new one.  I can do all that stuff with Javascript in the classic designer, but it is so much easier to do with Field Rules.  

1 0
replied on March 16

@████████

Unless I'm mistaken, this should be possible with the current LFForm API.

Based on my understanding, you can use the LFForm API to retrieve the field value(s), perform the necessary calculations, then use the LFForm API to set the appropriate field values.

2 0
replied on October 6, 2021

They are working on JavaScript functionality now. No ETA yet, just "Coming Soon"

Forms Designer Comparison (laserfiche.com)

1 0
replied on October 7, 2021

Thank you for the link.  Seems like a pretty important component to not have available at release.  

0 0
replied on December 28, 2021

I have not upgraded yet, but I'm curious.  Is the choice for which designer to use something that is universal through the server or decided on a case-by-case basis for individual processes or forms?

0 0
replied on December 28, 2021

@████████ it's case-by-case. When you add a new form (or a new business process with Form submission/approval selected) you can choose which designer to use, and you do seem to be able to mix-and-match within a process.

1 0
replied on December 28, 2021

Nice!  Thank you @████████

With so much custom Javascript on so many of my existing forms, the last thing I want is everything to break when we do upgrade to 11.

0 0
replied on December 28, 2021

No problem. They definitely set it up to allow for a gradual transition.

Not only do you still have the classic designer option, but forms made with the classic designer are only converted if you explicitly click the Convert button.

Additionally, when you Convert a form, it creates a separate copy and keeps the original until you delete it, so there's less risk involved.

1 0
replied on December 28, 2021

Oh wow!  That's a relief.

0 0

Forms 11 JavaScript in the new designer

Sign in to reply to this post.