[jala-dev] Code Convention in jalaForm.js

  • From: <Christoph.Lincke@xxxxxx>
  • To: <jala-dev@xxxxxxxxxxxxx>
  • Date: Fri, 11 May 2007 16:10:29 +0200


I'm currently trying to build a CSS for form generated by Jala and I was
wondering if the HTML output can be simplified. 

It basically started with the fact that there is a notion of "row" in
the IDs for something that is called "component" in the JavaScript. The
other thing is that I'm not fond of the underscores in id names. See 

Spending a while thinking about it, I'm tempted to believe that we don't
need so many IDs. 

Imagine you have a form called "myform" with and input called "title".
Then this is roughly the current HTML:
 <form id="myform" method="post" class="form" name="myform">
   <div id="myform_title_row" class="row require">
      <div id="myform_title_error" class="error">...</div>
      <label id="myform_title_label" for="myform_title">Title</label>
      <div class="element">
         <input id="myform_title" class="input" name="title" ... />

From the point of CSS formatting the following code (influenced by
http://alistapart.com/articles/prettyaccessibleforms) would be
 <form id="myform" method="post" class="form" name="myform">
   <li id="title" class="require">
      <div class="error">...</div>
      <label for="title">Title</label>
      <input class="input" name="title" ... />

This way we have less IDs and, even better, no hassle with their names. 

Please note that this is just a rough idea and I haven't thought about
every input element types yet. I don't see a problem CSS wise but maybe
some other aspects require IDs on every element. I'm also not sure if
I'm missing something important. 

What do you think? 


Other related posts:

  • » [jala-dev] Code Convention in jalaForm.js