1. #1
    Ext User
    Join Date
    Jul 2007
    Posts
    4
    Vote Rating
    0
    BlackICE1979 is on a distinguished road

      0  

    Default Server Side Forms {JSON} 2.x - Form Builder Updated

    Server Side Forms {JSON} 2.x - Form Builder Updated


    Hi There,
    I've update the excellent Form Builder for the 2.0 Version of Extjs. Hope you'll enjoy it!
    [CODE]/*
    * Building a basic form :
    //Prepare the form
    var remoteForm = new Ext.ux.FormBuilder({url:'/task/ajaxform', params:{taskidelectedId}});
    //Some Function to handle the problem
    var badDataPopup = function(f) {
    console.log('Bad Data: %o', f);
    Ext.MessageBox.alert('Bad Data', 'Unable to create form. Check your firebug console, cowboy!');
    }
    //Some Function to handle the submit that are successful
    var submitsuccess = function(f){
    window.hide();
    }
    //Some Function to handle the submit that has failed
    var submitfailed = function(f){
    Ext.MessageBox.alert('Error Message', action.result.errorInfo);
    }
    //A function to put the panel in a window (Desktop example)
    //Note: The formPanel is passed as an argument on the 'validform' event.
    //The formPanel is also returned as shown below.
    var createWindow = function(formPanel){
    window = new Ext.Window({
    title: 'Compl
    Last edited by BlackICE1979; 8 Nov 2007 at 6:08 AM. Reason: Server side code added

  2. #2
    Ext User
    Join Date
    Oct 2007
    Posts
    170
    Vote Rating
    0
    SeaSharp is on a distinguished road

      0  

    Default


    Hi I have been building something similar but in terms of scope and code volume you are way ahead.

    Could you explain your motivation for declaring many multiple functions for the field types? So far I have had some success building a form from a single json item element array passed from the server.

    Code:
    this.form = new Ext.FormPanel({
    
    		..
    		items: formDefinitionFromServer.Elements

  3. #3
    Ext JS Premium Member
    Join Date
    Mar 2007
    Location
    NL
    Posts
    607
    Vote Rating
    1
    mdissel is on a distinguished road

      0  

    Default


    are you sure this is for Ext 2.0? Ext.form.Column doesn't exist in 2.0, use layout:column and you can use "xtype" to specify the type of field.

    Thanks
    Marco

  4. #4
    Ext User
    Join Date
    Jul 2007
    Posts
    4
    Vote Rating
    0
    BlackICE1979 is on a distinguished road

      0  

    Default Columns

    Columns


    True True, I didn't test the whole thing but the rest work just fine. I'm just starting to use it in my project. I'll post an update soon and I plan to do the same trick with gridPanel!

    See ya!

  5. #5
    Ext User DigitalSkyline's Avatar
    Join Date
    Apr 2007
    Location
    Rochester, MI
    Posts
    461
    Vote Rating
    1
    DigitalSkyline is on a distinguished road

      0  

    Default


    What advantage does this have over just sending back the actual form definition in JSON? (ala 2.0)

  6. #6
    Ext User
    Join Date
    Jul 2007
    Posts
    4
    Vote Rating
    0
    BlackICE1979 is on a distinguished road

      0  

    Default Loading form from server JSON

    Loading form from server JSON


    Can you explain how you do it? Because I looked around and didn't find the documentation about that.
    Thanks

  7. #7
    Ext User tidal's Avatar
    Join Date
    Apr 2007
    Location
    Berlin / Germany
    Posts
    50
    Vote Rating
    0
    tidal is on a distinguished road

      0  

    Default


    Hi!

    The basic thing is Ext2.0 needs less more code and is pretty much straight forward.
    You can (for example) replace all the functions building the different field types by this:
    Code:
    this.form.add(config);
    where the config must at least look like something like this:
    Code:
    {xtype: 'radio'}
    Check the Ext.Component Documentation to learn more on xtypes.

    You can also check my Ext.ux.Plugin.RemoteComponent for one way how to do it.
    It can provide the remote functionally you need . Stick the Plugin in a
    Ext.form.FormPanel and there you go. So you will have a proper separation between
    the form- and the remote-functionality and you can still extend Ext.form.FormPanel,
    if you need more functionality on the forms.

    Timo

  8. #8
    Ext User tavox's Avatar
    Join Date
    Jun 2007
    Location
    Lima, Peru
    Posts
    23
    Vote Rating
    0
    tavox is on a distinguished road

      0  

    Default


    Quote Originally Posted by BlackICE1979 View Post
    True True, I didn't test the whole thing but the rest work just fine. I'm just starting to use it in my project. I'll post an update soon and I plan to do the same trick with gridPanel!

    See ya!
    When do you plan to post the update and the GridPanel???

    regards

  9. #9
    Sencha User
    Join Date
    Jul 2007
    Location
    Moscow, Russia
    Posts
    295
    Vote Rating
    0
    6epcepk is on a distinguished road

      0  

    Default


    Thanks for ux!
    But how must seeng JSON for ComboBox. I try with:
    PHP Code:
    {"type":"ComboBox","options":{"fieldLabel":"test"},"simplestore":{"fields":"['id', 'title']","data":"[[1, 1], [2, 2]]"}} 
    But no errors, no data...