-
24 Jul 2008 1:03 AM #1
Designing a Form on server side based on request
Designing a Form on server side based on request
Form layout needs to be designed using ext
Layout, number of elements and type of elements in the page should be built
dynamically - that means the values neeed to be fetched from the server side and
based on certain conditions the fields should be rendered.
Example:
Let's say we need to display Student Details & Staff details in the same form based
on the request.
If the request is "Student", then we need to display 10 fields and the field names
and values should be fetched from DB.
If the request is "Staff", then we need to display 20 fields and the field names and
values should be fetched from DB.
Better if it is explained with an example
Thanks in advance
-
24 Jul 2008 2:08 AM #2
Ok, so... what's the question?
Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
-
24 Jul 2008 5:53 AM #3
my guess is .. "How to do it ..."
I think you have to create an empty form
after that make an ajax call and get needed field details ..
create fields and add them to form ... since PanelForm is subclass of a form you can remove existing fields and add new ones in ..
hope this helps ..
bye
Armando
-
24 Jul 2008 8:01 AM #4
Make an ajax request to the server which returns json containing an array of field definitions. In the ajax success handler, create the form panel, using the returned json as its items collection.
-
24 Jul 2008 9:22 AM #5
"be dom-ready..."
Doug Hendricks
Maintaining ux: ManagedIFrame, MIF2 (FAQ, Wiki), ux.Media/Flash, AudioEvents, ux.Chart[Fusion,OFC,amChart], ext-basex.js/$JIT, Documentation Site.
Got Sencha licensing questions? Find out more here.
-
28 Jul 2008 8:04 PM #6
Is it possible to build the Ext form in server side itself ?
Is it possible to build the Ext form in server side itself ?
s, the question is "How to do it..." . Thanks for your help.
As you replied , the field details will be fetched from server side and the form building process will be handled in client side(java script).
Is it possible to build the Ext form in server side itself ?
====================================================================
-
28 Jul 2008 8:19 PM #7
Yes, it's most definitely possible. Generate the appropriate JSON on the server and send it back to the client.
To make it easier, you may want to use/write your own JSON library to assist you.
I even went so far as to create a simple .NET library to assist in creating Ext objects:
Code:Panel p = new Panel(); p.Title = "Foo"; p.AutoWidth = true; Response.Write(p.ToJson());
Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
-
29 Jul 2008 3:00 AM #8
is it possible to define the panel in the server side itself ?
is it possible to define the panel in the server side itself ?
Thanks for your help. Have gone through the thread.
Inference: The form panel is defined in the client side. And the fields can be built from server side on it.
I need one more step to go.
We need to decide which is to be used - whether form panel or grid or whatever, in the server side itself.
is it possible to define the panel in the server side itself with its fields ?
-
29 Jul 2008 3:07 AM #9
Technically, you could do EVERYTHING server side, example:
That assumes that say, o is a form panel declaration.Code:Ext.onReady(function() { var v = new Ext.Viewport(); Ext.Ajax.request( { url: 'myLoader', success: function(response) { var o = Ext.decode(response.responseText); v.add(o); v.doLayout(); } } ); } );Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!


Reply With Quote



