Saturday, March 03, 2007

An HTML Form Builder

Here is a form builder I wrote in Erlang. I had an idea earlier, related to a project that my brother wants me to work on. I thought that it would be fruitful for us to both sit down for a few hours constructing a web site. He does not know how to code, but he can discuss aspects of what I am hacking up, so we can discuss changes while I am coding. I told him that I want to make the process of creating forms quickly, so, in a stroke of inspiration, I threw this little module together.

There is little error checking involved in the code, but then, maybe, given the Erlang guidelines, this is a good thing. Look and see. Maybe you'll find it useful. I am going to update it when I need to.


The code is here. An example form: here. Sample test code: here.


UPDATE: This little sample code makes me extremely happy, because I was able to have a very vague idea of what I wanted, and I was able to translate those ideas into working code in a reasonable amount of time. I think I can attribute this to functional programming and pattern matching. My next step (er, tomorrow :) ) Is to make a web page to generate forms, with interest in accomplishing what I want to do when my brother and I sit down and get some code working for our app.

3 Comments:

Anonymous Anonymous said...

I like this idea a lot, in fact, I think you should expand it beyond simple form building into complete page generation.

I've been messing around with Seaside for a couple of months and one of the things that I like about it is that there are no templates: you stay inside the language to generate your semantic html and use external css for styling.

12:52 PM  
Blogger Brian Olsen said...

Yep - this will slowly build itself into a more complete system. That is what I am going to start hacking together today, given the list of specs I scribbled out on looseleaf paper. :)

Spending a lot time on form applications is annoying. I'd rather say "here's my form, and this is what to do when my form is called." I specified a pattern earlier in my ErlyWeb tutorial on how to do that. I am going to expand upon that a bit.

In essence, I want to play with something in an app before I actually refine my HTML. I want to sit with someone with no software development experience and draw stuff to the screen, and use that stuff, so we will be more open to considering what-ifs. Dealing with the mechanics of the app at that stage is just frustrating.

For what it is worth, I have apps in mind that can use this.

1:44 AM  
Blogger etnt said...

I've also been doing some work in this area. I wanted to create a way of easily
specify a form, then generate both Javascript code that perform checks in the browser, as well as Erlang code that do the checks on the Erlang side. I got the first two parts working. If you'd interested, you'll find the code here:

http://www.tornkvist.org/ehtml_form.erl

Cheers, Tobbe

1:24 AM  

Post a Comment

<< Home