The fastest easiest way to get it right.

HTML Inputs and The Data Dictionary

The Data Dictionary is very useful for producing specialized HTML. One of the more tiresome tasks of database development is the need to make up specialized inputs for many different fields, with different rules for different types, different alignment, different sizes, and so on.

Andromeda provides the input() function which can be used to generate consistent standardized inputs based on the information in the data dictionary.

class x6example extends androX6 {
    function x6main() {
        # Load the dictionary
        $dd = ddTable('configfw');
        # Now dump a simple input for each column
        # in the table
        $top = html('div');
        foreach($dd['flat'] as $colname=>$colinfo) {
            $input = input($colinfo);

Each input has special attributes that can be used by browser-side code for whatever purpose you may need. These custom attributes always have the letter 'x' as a prefix to their name. They generally have the same name as data dictionary properties except they lack underscores:

  • xtableid: the table id
  • xcolumnid: the column id
  • xroupd: If "Y", the column should be read-only when updating
  • xroins: If "Y", the column should be read-only for inserts
  • xtypeid: Same as "type_id" in the data dictionary
  • xcolprec: Same as "colprec" in the data dictionary
  • xcolscale: Same as "colscale" in the data dictionary.

Using jQuery to Find Controls

You can make use of the special attributes that Andromeda adds to its inputs to easily find controls that correspond to certain database columns.

If you want to find the input that is bound to the column "group_id" in table "groups", the following jQuery selector will do that:

comments powered by Disqus
Home |  Documentation |  Download |  Credits |  Contact |  Login
Andromeda © Copyright 2004-2013, Licensed under the GPL Version 2