HZNM.COM
welcome to my space
X
Search:  
 HOME   Populating a Form
Populating a Form
Published by: jane 2009-01-09
Welcome to:hznm.com

  • I have been searching and trying different stuff for 1 1/2 days but can seem to figure out how to get populate this form using json. Ive probably seen about 20 different ways to do it but just can get it to work. Thanks in advance for any help.


    Ext.QuickTips.init();
    Ext.form.Field.prototype.msgTarget = "side";
    var userProfileForm = new Ext.form.FormPanel({
    name: 'userProfileForm',
    renderTo:"UserInfoForm",
    width:470,
    labelWidth:160,
    frame:true,
    monitorValid:true,
    items: [
    new Ext.form.Hidden({
    name: "user_id"
    }),
    new Ext.form.TextField({
    name:"first_nm",
    fieldLabel:"First Name",
    width:265,
    allowBlank:false,
    blankText:"Please enter a First Name"
    }),
    new Ext.form.TextField({
    name:"last_nm",
    fieldLabel:"Last Name",
    width:265,
    allowBlank:false,
    blankText:"Please enter a Last Name"
    }),
    new Ext.form.TextField({
    name:"mlsAgent_id",
    fieldLabel:"MLS Agent ID",
    width:265,
    allowBlank:true
    }),
    new Ext.form.TextField({
    id:"team_id",
    fieldLabel:"Team ID",
    width:265,
    allowBlank:true
    }),
    new Ext.form.TextField({
    name:"email_txt",
    fieldLabel:"Email Address",
    width:265,
    allowBlank:false,
    blankText:"Please enter an Email Address",
    vtype:"email",
    vtypeText:"Enter a valid Email Address"
    }),
    new Ext.form.TextField({
    name:"title_txt",
    fieldLabel:"Title",
    width:265,
    allowBlank:true
    }),
    new Ext.form.TextField({
    name:"phone_no",
    fieldLabel:"Phone No",
    width:265,
    allowBlank:true
    }),
    new Ext.form.TextField({
    name:"mobile_no",
    fieldLabel:"Mobile No",
    width:265,
    allowBlank:true
    }),
    new Ext.form.TextField({
    name:"fax_no",
    fieldLabel:"Fax No",
    width:265,
    allowBlank:true
    }),
    new Ext.form.TextField({
    name:"website_url",
    fieldLabel:"Personal Website",
    width:265,
    allowBlank:true
    })
    ]
    buttons:[{
    text:'Update Information',
    formBind: true,
    // Function that fires when user clicks the button
    handler:function(){
    userProfileForm.getForm().submit({
    method:'POST',
    waitTitle:'Saving Information',
    waitMsg:'Sending data...',
    url: '/api/user-save/type/profile/',
    success:function(){
    Ext.Msg.alert('Status', 'Save Successful!', function(btn, text){
    if (btn == 'ok'){

    }
    });
    },
    failure:function(form, action){
    if(action.failureType == 'server'){
    Ext.Msg.alert('Save Failed! Please try again.');
    }else {
    Ext.Msg.alert('Warning!', 'Server is unreachable');
    }
    }
    });
    }
    }]
    })
    userProfileForm.getForm().load({url:"/api/userinfo", waitMsg:"Loading User Data"});

    JSON (verified using jslint)

    {"success":true,"data":{"first_nm":"Mike","last_nm":"Camire","mlsAgent_Id":"645872","email_txt":"mcamire1@yahoo.com","title_txt":"Realtor"
    ,"phone_no":"000-000-0000","mobile_no":"","fax_no":"","website_url":"http://www.devonshirehomes.com"}}


  • All the fields and the json return look right. I am assuming you are not doing the load until after the form is rendered. I don't know if having that reader attribute on the form would interfere with the ajax load. I would just step through it all in the firebug debugger, including the load success handler.

    Man I didnt see that I had left that reader in there. Guess thats what happens when you stare at the code too long. Thanks, I got it working.


  • Obvious questions, have you verified you are getting the JSON string back in your success handler? I use a similar format - although I always set both success and failure attributes, but I don't think that is necessary.

    Yea that is the json string that is coming back in firebug.


  • Obvious questions, have you verified you are getting the JSON string back in your success handler? I use a similar format - although I always set both success and failure attributes, but I don't think that is necessary.


  • All the fields and the json return look right. I am assuming you are not doing the load until after the form is rendered. I don't know if having that reader attribute on the form would interfere with the ajax load. I would just step through it all in the firebug debugger, including the load success handler.





  • How much does getting a small tattoo on your hip/stomach hurt?
    Do anyone else have an itchy anus? ?

    You are looking at:hznm.com's Populating a Form, click hznm.com to home
  • how do i tell if he likes me
  • how bad does a tattoo hurt pelvis
  • joe the plumber claims to support the war in iraq so why isn 039 t he over there fighting for what he believes in
  • my boyfriend won 039 t ask me out on a date
  • isn 039 t it amazing how the vast majority of engineers and architects are not persuaded by
  • do you feel like cybering chatrooms are the saddest thing you 039 ve ever seen
  • would you watch this through and leave a comment please
  • i need to improve my science grade help
  • is it good or bad that there 039 s overwhelming worldwide support for obama
  • why shouldn 039 t we attack joe the non plumber considering what an ignorant know nothing right winger he is
  • would you ever post your number online
  • my aunt is constantly flirting with random old guys why
  • are there parts of the body that hurt when tattooed more than other parts
  • of all the monsters you can think of which one is the least scary to you
  •  
  • what part of pro american parts of the country ” you like to visit
  • white sage cleansing
  • school bus question anyone
  • do blacks stretch racial background to fit in society
  • is this the truth about so called african americans
  • segregation in the 1930 039 s for orphans native american and african american
  • what ethnicity does my mother look
  • other songs like these
  • question for black people i can no longer endure
  • is someone considered subversive and anti establishment if 30 million other people are doing it
  • how do i dance in a middle school dance
  • please help need help with ideas for learning game for kindergarten grade
  • ladies when on a date do you expect the man to
  •  Homepage | Add to favorites | Contact us | Exchange links | LOGIN | Site map | 
    Copyright© 2008 hznm.com        Site made:CFZ