-
8 Nov 2007 6:06 AM #1
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:{taskid
electedId}});
//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: 'ComplLast edited by BlackICE1979; 8 Nov 2007 at 6:08 AM. Reason: Server side code added
-
8 Nov 2007 6:38 AM #2
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
-
8 Nov 2007 7:07 AM #3
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
-
8 Nov 2007 7:22 AM #4
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!
-
8 Nov 2007 4:52 PM #5
What advantage does this have over just sending back the actual form definition in JSON? (ala 2.0)
-
14 Nov 2007 6:00 AM #6
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
-
14 Nov 2007 9:07 AM #7
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:
where the config must at least look like something like this:Code:this.form.add(config);
Check the Ext.Component Documentation to learn more on xtypes.Code:{xtype: 'radio'}
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
-
19 Dec 2007 9:08 PM #8
-
9 Jan 2008 6:35 AM #9
Thanks for ux!
But how must seeng JSON for ComboBox. I try with:
But no errors, no data...PHP Code:{"type":"ComboBox","options":{"fieldLabel":"test"},"simplestore":{"fields":"['id', 'title']","data":"[[1, 1], [2, 2]]"}}


Reply With Quote


