Click here to Skip to main content
16,006,006 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
my question is :
i have lots of form in my project , and i want to have a "deserilizeForm" and "serializeForm" functions in my code , i'm not allowed to use a Plugin .
i need the function to be like this :
C#
deserilizeForm: function (DIVID, obj) {//fill
          debugger


       for (var i in obj) {
           var id = i;
           var val = obj[i];
           var control = $('#' + DIVID + ' #' + id + ' [name="' + id + '"');


           switch (contol.type) {
               case 'text':
                   control.val(val);
                   // code
                   break;

               default:
                   // code
           }
       }
        },

the obj is a Json obj for example :
JavaScript
{ "index": 1,
                        "firstName": "John",
                        "lastName": "Jones",
                        "joined": "April 2015",
                        "Country": "Amman",
                        "Gender": "Male",
                        "Active": "False",
                        "NOC": 4
                       
                    }
Posted
Updated 4-Oct-15 22:49pm
v2
Comments
OriginalGriff 5-Oct-15 4:52am    
And?
What have you tried?
Where are you stuck?
What help do you need?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900