Andrew Pollack's Blog

Technology, Family, Entertainment, Politics, and Random Noise

Creating a form generating tool that lets non-technical publshers create rich web forms

By Andrew Pollack on 08/22/2010 at 12:13 AM EDT

I've been working on a tool for a client that wants to be able to create web forms to use on their site without learning any programming at all. At the same time, I don't trust any data from the browser side on a web site. I always assume that the browser side is open to hackers. That means any submitted form data has to be validated before it is accepted. Here's what I did...

For publishing, I used the CKEditor, which is the web browser rich editor I've standardized on. For most web publishing uses, I use an icon set that doesn't include the buttons for creating fields and forms. For this use, I turned those back on. The result is that right off the bat I've got a slick editor that lets the publishers lay out the form any way they want. The output from the editor is a big chunk of html stored in a text field on the Domino form when it is submitted.

The tricky part comes when the new form layout is saved. A webQuerySave agent reads the html that contains the form and parses out all the fields, keeping track of the field names, values, option lists, field types, and so on. In short, the agent quickly grabs all the information needed to validate the forms that will ultimately get submitted by an end user. This was really the tricky part, since the HTML isn't xml compliant enough to use existing parsing tools. You've got to account for all kinds of perfectly common variation in how field parameters are specified. Once you get it right though, the possibilities really open up. Field names are checked against a list of reserved field names, and a simple list of the field names is saved back so that the publisher can pick from them to indicate which are to be required fields.

Displaying the finished form to users could be done several ways. One way to do it would be to use DXL to generate an actual Domino based form that matches the fields defined in the layout. The advantage there is that Domino would do all the validation for me and it would be immune to many of the kinds of security attacks that I'd otherwise have to code for myself. In my case, I opted not to go that way because there will be so many different forms. In my case, each of these custom forms has an ID that is used on the website using a special form built into those publishing tools. The custom form's ID is passed as a parameter to a generic form display page. The ID is taken from the parameter and an AJAX call quickly grabs the custom form code and inserts it onto the page. When the form is submitted, the action points to another agent which receives the user data and validates it against the form's definition.

The benefit here is that where we've already empowered non-technical content owners to create and manage rich sites themselves, now we've added the ability to let them design and publish their own forms right within the site in a way that doesn't limit the way the forms are laid out in any way.

Very cool stuff.


There are  - loading -  comments....

re: Creating a form generating tool that lets non-technical publshers create rich web formsBy Erik Brooks on 08/22/2010 at 08:33 AM EDT
What types of fields/controls did you allow the users? I've dabbled with
CKEditor but don't remember much about the field attributes.
re: Creating a form generating tool that lets non-technical publshers create rich web formsBy Andrew Pollack on 08/22/2010 at 09:44 AM EDT
Checkboxes, Radiobuttons, Text, TextArea, and Selection boxes are all fully
supported. I haven't tried file attachments -- not sure how I'll set it up to
receive them on the back end if I use them.
re: Creating a form generating tool that lets non-technical publshers create rich web formsBy Wayne on 08/22/2010 at 01:08 PM EDT
So, you've built a Domino version of sharepoint, well, minus some of the work
flow stuff, but it wouldn't take much to build a simple template system to jump
start users form design would it?

Anyway, congratulations, sounds like a great project.

re: Creating a form generating tool that lets non-technical publshers create rich web formsBy Andrew Pollack on 08/22/2010 at 01:26 PM EDT
That's an interesting way to look at it, and no - in fact templates would be a
cake walk to add.
re: Creating a form generating tool that lets non-technical publshers create rich web formsBy Wayne on 08/23/2010 at 10:57 AM EDT
Another query, what kind of effort would it have taken to do this using only
the notes client?
re: Creating a form generating tool that lets non-technical publshers create rich web formsBy Andrew Pollack on 08/23/2010 at 07:53 PM EDT
Not sure how to answer that since the whole point is to let browser users
create web forms. Entirely in Notes wouldn't make any sense to me.
re: Creating a form generating tool that lets non-technical publshers create rich web formsBy Wayne on 08/24/2010 at 11:32 AM EDT
This is more curiosity than anything else. In my situation we don't need web
based tools. Internet access is expensive, and there are additional issues with
security and access. For our company size, the web direction actually adds
overhead to business process activities. Notes and Domino cover most
requirements, but the Notes client lacks certain user interface surfaces.
When I see developers write about the virtues of Web 2.0 the only area where
Notes lags is in the interface capability. What I see happening is loads of
effort/money being poured into an effort to achieve what Notes/Domino have been
doing for the last decade.
re: Creating a form generating tool that lets non-technical publshers create rich web formsBy Stephan H. Wissel on 08/22/2010 at 08:55 PM EDT
Hi Andrew,
you might want to try HTMLCleaner. It's a parser that takes in HTML that is not
(fully) XML compliant and returns a DOM. The CK stuff is good enough to not
loose any data in the process. I found HTMLCleaner to work better than JTidy
when used with LS2J. Need some sample code? Let me know.
re: Creating a form generating tool that lets non-technical publshers create rich web formsBy Andrew Pollack on 08/23/2010 at 07:55 PM EDT
The code I wrote myself is native, and does a good job picking out the fields
and field data, but thanks.
re: Creating a form generating tool that lets non-technical publshers create rich web formsBy Dwight Wilbanks on 08/30/2010 at 01:16 PM EDT
I have not looked into the guts of the newer versions, (since they called it
fck) but, they used to have an xml flag somewhere in the config, that I thought
impacted how the html looked before it was submitted. I could be wrong on that
though.
Creating forms and views easilyBy John Dillon on 09/16/2010 at 08:43 PM EDT
Yep, very slick!

I wrote an "application builder" tool that generates forms and views for the
Notes client, based on certain standard things we used in all our applications,
including layout.

However, I doubt it was as fancy as what you've got.

Still, it made creating new applications a snap--the "busy work" of form layout
was eliminated in favor of thinking about the workflow in the back (which in
turn was simplified using ProcessIt from Teamwork Solutions.)

Oh, by the way, the core mechanism I used was DXL.


Other Recent Stories...

  1. 05/05/2016Is the growing social-sourced economy the modern back door into socialism?Is the growing social-sourced economy the modern back door into socialism? I read a really insightful post a couple of days ago that suggested the use of social network funding sites like “Go Fund Me” and “Kickstarter” have come about and gained popularity in part because the existing economy in no longer serving its purpose for anyone who isn’t already wealthy. Have the traditional ways to get new ventures funded become closed to all but a few who aren’t already connected to them and so onerous as to make ...... 
  2. 04/20/2016Want to be whitelisted? Here are some sensible rules for web site advertisingAn increasing number of websites are now detecting when users have ad-blocking enabled, and refuse to show content unless you "whitelist" their site (disable your ad-blocking for them). I think that is a fair decision on their part, it's how they pay for the site. However, if you want me (and many others) to white list your site, there are some rules you should follow. If you violate these rules, I won't whitelist your site, I'll just find content elsewhere. 1. The total space taken up by advertisements ...... 
  3. 12/30/2015Fantastic new series on Syfy called “The Expanse” – for people who love traditional science fiction[] “The Expanse” is a new science fiction series being broadcast onthe Syfy channelthis winter. It’s closely based on a series of books by author James S. A. Corey beginning with “Leviathan Wakes”. There are 5 books in the “Expanse” series so far. If you’re a fan of the novels you’ll appreciate how closely the books are followed.TIP: The first five episodes are already available on Syfy.com. If you’re having trouble getting into the characters and plot, use those to get up to speed.The worlds created for ...... 
  4. 10/20/2015My suggestion is to stay away from PayAnywhere(dot)com  
  5. 08/07/2015Here is one for you VMWARE gurus - particularly if you run ESXi without fancy drive arrays 
  6. 08/06/2015The Killer of Orphans (Orphan Documents) 
  7. 06/02/2015Homeopathic Marketing: Traveler on my Android is now calling itself VERSE. Allow me to translate that for the IBM Notes community... 
  8. 03/17/2015A review of British Airways Premium Economy Service – How to destroy customer goodwill all at once 
  9. 02/26/2015There's a bug in how @TextToTime() and @ToTime() process date strings related to international standards and browser settings. 
  10. 01/21/2015Delivering two new presentations at Developer Camp (EntwicklerCamp) 2015 in Germany 
Click here for more articles.....


pen icon Comment Entry
Subject
Your Name
Homepage
*Your Email
* Your email address is required, but not displayed.
 
Your thoughts....
 
Remember Me  

Please wait while your document is saved.