1. #1
    Ext User
    Join Date
    May 2010
    Posts
    1
    Vote Rating
    0
    yoyoyo is on a distinguished road

      0  

    Exclamation Dynamically generate and populate a FormPanel

    Dynamically generate and populate a FormPanel


    Hi All,

    The question has already been asked a fair bit on the internet but I couldn't get my hands on a solution that actual works.

    What i'm trying to achieve is the following:

    1. retrieve a json array using ajax which contains the definition of the form to generate
    2. parse that array and add into a FormPanel all required TextField
    3. render the result into the interface

    At the moment I'm pretty much adding text fields to the FormPanel using the add() function (i.e. form.add(field)). The TextField becomes visible on the page but when I submit the form by clicking on the button, the content of that field does not get posted to my server.

    Any solution or workarounds?


    Thanks for your time.
    Last edited by yoyoyo; 20 May 2010 at 11:59 PM. Reason: typo in the title

  2. #2
    Ext User
    Join Date
    May 2010
    Posts
    33
    Vote Rating
    0
    kevin-berry is on a distinguished road

      0  

    Default


    Hi, I'm currently working on the same thing - I haven't got it completely figured yet, as I'm still in the process of getting all the elements configured how I need them, but perhaps this thread will help you. If I figure it out, I'll try to remember to let you know how I did it.

    http://www.extjs.com/forum/showthrea...699#post466699

  3. #3
    Sencha User steffenk's Avatar
    Join Date
    Jul 2007
    Location
    Haan, Germany
    Posts
    2,663
    Vote Rating
    6
    steffenk has a spectacular aura about steffenk has a spectacular aura about steffenk has a spectacular aura about

      0  

    Default


    i created a very easy example. The form is generated by a php file where i randomly create fields.
    PHP Code:
    <?php 
    $action 
    $_REQUEST['action'];
    $out = array();
    $fieldTypes = array('input','textarea','int','checkbox');
    if (
    $action) {
        if (
    $action === 'getForm') {
            for (
    $i 0$i 10$i++) {
                
    $out['data'][] = 
                    array(
                        
    'name' => 'field' . ($i+1),
                        
    'label' => 'Field ' . ($i+1),
                        
    'type' => $fieldTypes[rand(0,3)],
                        
    'value' => 'V' rand(11119999)
                    );
            }
        }
        echo 
    json_encode($out);
    }
    ?>
    Online example with source:
    http://dev.sk-typo3.de/ext/jsonform.html
    vg Steffen
    --------------------------------------
    Release Manager of TYPO3 4.5

  4. #4
    Sencha User
    Join Date
    Dec 2007
    Posts
    115
    Vote Rating
    12
    corvonero will become famous soon enough

      0  

    Default


    Hello,
    I'm actually *thinking* about something very similar for an ongoing project.

    Nothing I can add to your knowledge at this time, apart from the fact that in such case I would concentrate in client side checking rules.

    When you're in need of creating the form dinamically, there's also a very high chance that this form is going to be very complex and require complex validation rules, which would be nice to implement at client side as well.

    Also, to keep it even more complex, there might be a strong need to show some fields only if some other fields exists/has a certain value.

    ie:

    if (comboBox.value == '3') {
    showField(x);
    } else {
    showField(y);
    }

    If you're developing some kind of 'standard' I think you should not avoid such a features, or at least plan for them.

    M.

  5. #5
    Sencha User
    Join Date
    Sep 2010
    Location
    India
    Posts
    40
    Vote Rating
    0
    pratik016 is on a distinguished road

      0  

    Default


    Hello Friends,
    I think now anyone of you might got this answer...
    I am also stuck here for the same situation. Please give reply on my thread.
    http://www.sencha.com/forum/showthre...604#post525604
    Please please do some help. I am assuming that you solved your problem as this thread is very old

Similar Threads

  1. unable to dynamically generate a treepanel
    By pailyanish in forum Ext 3.x: Help & Discussion
    Replies: 1
    Last Post: 30 Sep 2009, 1:03 AM
  2. Viewport generate items dynamically ?
    By Fabyo in forum Ext 2.x: Help & Discussion
    Replies: 0
    Last Post: 18 Nov 2008, 8:57 AM
  3. Dynamically Generate Window
    By hanson72 in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 22 Aug 2008, 9:57 AM
  4. Dynamically generate column panel via ajax request
    By Zakaroonikov in forum Community Discussion
    Replies: 0
    Last Post: 26 Mar 2008, 9:38 PM
  5. How to Generate Combo values dynamically based on previous selection
    By msuresh in forum Ext 2.x: Help & Discussion
    Replies: 6
    Last Post: 14 Jan 2008, 9:33 AM

Thread Participants: 4

Tags for this Thread

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..."