JavaScript
  Home arrow JavaScript arrow Page 3 - Constructing a Multi-Column Online Form wi...
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
JAVASCRIPT

Constructing a Multi-Column Online Form with the Ext JS Framework
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 3 stars3 stars3 stars3 stars3 stars / 2
    2009-02-10

    Table of Contents:
  • Constructing a Multi-Column Online Form with the Ext JS Framework
  • Review: building a field-set grouped web form using the Ext JS library
  • Building a multi-column web form
  • Listing the application’s full source code

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Constructing a Multi-Column Online Form with the Ext JS Framework - Building a multi-column web form


    (Page 3 of 4 )

    At the end of the previous section, I promised you that I was going to show you how to use the Ext JS library to build a multi-column web form, and that’s precisely what I’ll do in the next few lines.

    As you’ll see in a moment, constructing this form requires working with an instance of the already familiar “FormPanel” JavaScript class. Its layout must be slightly tweaked so that it can accommodate different input boxes in a multi-column fashion.

    Additionally, it's possible to incorporate an HTML editor into the form. Such an editor can be pretty useful, for instance, if you’re developing a web-based email application. But it’s time to set aside this boring theory and show some functional code, so here’s the JavaScript snippet that renders this multi-column web form:

    Ext.onReady(function(){

    Ext.QuickTips.init();

    var theform=new Ext.FormPanel({

    labelAlign: 'top',

    frame:true,

    title: 'Multi Column, Nested Layouts and HTML editor',

    bodyStyle:'padding:5px 5px 0',

    width: 600,

    items: [{

    layout:'column',

    items:[{

    columnWidth:.5,

    layout: 'form',

    items: [{

    xtype:'textfield',

    fieldLabel: 'First Name',

    name: 'first',

    anchor:'95%'

    }, {

    xtype:'textfield',

    fieldLabel: 'Company',

    name: 'company',

    anchor:'95%'

    }]

    },{

    columnWidth:.5,

    layout: 'form',

    items: [{

    xtype:'textfield',

    fieldLabel: 'Last Name',

    name: 'last',

    anchor:'95%'

    },{

    xtype:'textfield',

    fieldLabel: 'Email',

    name: 'email',

    vtype:'email',

    anchor:'95%'

    }]

    }]

    },{

    xtype:'htmleditor',

    id:'bio',

    fieldLabel:'Comments',

    height:200,

    anchor:'98%'

    }],


    buttons: [{

    text: 'Save'

    },{

    text: 'Cancel'

    }]

    });

    theform.render(document.body);

    });


    As you can see, the above example demonstrates how to create a multi-column web form by means of the “FormPanel” JavaScript class. In this case, a brand new parameter, called “layout,” is passed in to the class constructor to achieve the desired layout for the respective form elements.

    Also, you should notice that this web form includes a text area box, not surprisingly labeled “Comments,” which comes in handy for letting users enter their comments or even, perhaps, composing email messages. However, the most interesting detail to stress here is the specification of an “xtype: ‘htmleditor” parameter.

    This argument tells the Ext JS library to render a complete HTML editor for that specific comment box, similar to the one you use with your Yahoo! and Hotmail web-based accounts.

    Do you realize that this package will build a neat HTML editor with a single line of code? You may want to tell this to Dreamweaver’s development team!

    The following image should give you an idea of how this online form really looks.

    Now that you have learned how to build a multi-column web form with the Ext JS library, it’s time to show the complete source for this web application, including the corresponding source dependencies and a bit of structural markup as well.

    Please read the next section. It’s only one click away.

    More JavaScript Articles
    More By Alejandro Gervasio


       · The Ext JS library permits to build, among other useful interfacing components,...
     

    JAVASCRIPT ARTICLES

    - Comparing Fields and Customizing Error Messa...
    - Checking Numbers and File Extensions with jQ...
    - Validating Digits and Dates with jQuery`s Va...
    - Validating Ranges, Emails, and URLs with jQu...
    - More Uses for the jQuery Tooltip Plug-in`s b...
    - Building Image-Based Tooltips with the jQuer...
    - Using the jQuery Tooltip Plug-in`s bodyHandl...
    - Using Rangelength, Min and Max with the Vali...
    - Using Minlength and Maxlength with the Valid...
    - Modifying Tooltip Coordinates with the jQuer...
    - Applying a Fade Out Effect with the jQuery T...
    - Tracking Mouse Movements with the jQuery Too...
    - Checking Online Forms with the Validator jQu...
    - Nested JavaScript Functions as Objects
    - The jQuery Tooltip Plug-in







    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 4 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek