posted on November 29, 2018

This question got me thinking about making the Forms customization experience smoother and more predictable.

I like that the decision was made to use JavaScript and CSS for Forms customization. The alternative is a custom rules engine to handle UI customization. I've seen other products implement something like that, and it requires zero code, but it gets unwieldy and fragile very quickly and it severely limits customizability.

Instead, it would be nice if we could get a runtime generated JS library that wrapped the form, it's fields, values, css, and events. (I know, not a trivial ask)

The advantage to that for the users would be a domain specific language for interacting with forms.

// LFForm is the global form object, and InvoiceTotal is a wrapper around the elements for the question named InvoiceTotal
LFForm.InvoiceTotal.Changed = (value) => {
    if(value > 100) {
        LFForm.SupervisorApprovalWarning.Show();
        LFForm.InvoiceTotal.ApplyCSS("warning");
    }
}

The best part is no jQuery. The second best part is no jQuery.

The advantage to Laserfiche would be that the wrapper library could allow different behavior to be injected depending on if it was running in the browser, or in a rendering process like PhantomJS. You could turn off, or change the behavior of events based on the environment. The DSL would give users a more consistent experience, while maintaining some of the flexibility of JS. There are a lot of Forms questions that come down to helping somebody track down the right selector syntax to find the element they want to change. For most folks, a wrapper would simplify things, but it wouldn't necessarily need to prevent advanced users from directly manipulating the DOM themselves, and CSS could still be an option. Although, a few custom CSS classes that provided semantically correct rules for common scenarios would be pretty great.

I realize that this is a big thing to request, and I might be off in the weeds, but I definitely think that there is room for improvement over the current model.

5 0