Agility Form Builder and Custom Validation Code

The Javascript implementation of the Form Builder should be better exposed to allow for integration of custom validation on submission. Currently it is not possible to customize the JS or HTML of the Form Builder on a page.



  • Official comment

    Thanks Giovanni! We'll be reviewing these feature requests on a weekly basis now and we'll follow up to let you know if this is something that will be in the works.

    Comment actions Permalink
  • @Giovanni

    Thanks for posting your idea! I'd like to pick your brain a little more on this one...

    1. Would you want a JS hook somewhere in the CMS where you can write your own JS such as "OnSubmit" or something? or would you want to do this in your own code on the website?

    2. In regards to the customizing the JS/HTML, would you be able to provide a use case for this though?

    3. I'm assuming your goal of all of this is to use the Form Builder for more things, as opposed to coding your own form? Essentially, get more done faster with forms correct?
    Comment actions Permalink
  • Hey James,

    You are correct in assuming my goal is to use form builder for more things, currently it does an all right job of getting a form on the page, but is has many deficiencies currently.

    1. Optimally I'd like to have to include the JavaScript through a build process (we use Webpack) that would mean that front-end dependencies for the form should be hosted publically so I can pull the package down.

    This would then allow us to conditionally include the code. Right now I achieve this in a suboptimal way where I check the content zones for any modules with the name "form builder" in a template, then include the UGC scripting:

    if (ContentZoneHelper.ContentZonesHaveModule("FormBuilder") || ContentZoneHelper.ContentZonesHaveModule("Form Builder"))
    @section ScriptsHead {

    Having the script so that it can be included using dependency injection would be very useful.

    2. For customizing the HTML I understand the difficulty in getting at the HTML, but I've run into issues where it is difficult to orient inputs, or there are attributes that I might additionally need (character limits in inputs).

    As for the Javascript would mainly be for having access to a JS hook such as "OnSubmit" in that instance. Then users could add their own implementation of Google Recaptcha for instance, or perhaps additional validation before submitting. 

    Or what if a user would like to implement a different front-end validation of elements?

    3. The goal is simply creating an effective form, and there are things that are missing in the current form builder implementation (correct me if I am wrong in any of this):

    • No localization on the inputs
    • No way to add maxlength to a field
    • No way to enforce a regex on a field
    • Basically front-end implementation of what you see in your UGC definitions:

    Developing the form in a way that allows for technical users to customize the form to fill functionality gaps, would allow the use of the good features in the form builder without having create their own from scratch.

    I'd love to always use the form builder if possible, because despite its shortcomings currently, it is good and useful :)

    Hopefully that gives some insight.

    Comment actions Permalink

Please sign in to leave a comment.

Didn't find what you were looking for?

New post