Skip to content Skip to sidebar Skip to footer

Problems Saving Data In Added Fields To A Javascript Form

Abstract: I'm attempting to add fields to a sort of online personal profile for members in an organization, written in javascript. I'm really REALLY new to this language and so I'

Solution 1:

Anticlimactic solution courtesy of RUJordan on a separate question that I posted about the "unrecognized expression error"

Source: https://stackoverflow.com/a/18541225/2540204

The issue was I was missing closing brackets on all my new form fields so

if(n < upsmart.people.people.length) {
            p = upsmart.people.people[n];
            item.find("input[name=pfname]").attr("value",p.fname);
            item.find("input[name=plname]").attr("value",p.lname);
            item.find("input[name=ptitle]").attr("value",p.title);
            item.find("textarea[name=pbio]").attr("value",p.bio);
            item.find("input[name=photo]").attr("value",p.photo);
            item.find("input[name=owner]").attr("value",p.owner);
            item.find("input[name=ownership_percentage]").attr("value",p.ownership_percentage);
            item.find("input[name=pedu").attr("value",p.edu);
            item.find("input[name=pskills").attr("value",p.skills);
            item.find("input[name=pprof").attr("value",p.prof);
            item.find("input[name=pawards").attr("value",p.awards);
            item.find("input[name=pcommunity").attr("value",p.community);
            item.find("input[name=pyears").attr("value",p.years);
            item.find("input[name=pcompensation").attr("value",p.compensation);
        }

Became

if(n < upsmart.people.people.length) {
            p = upsmart.people.people[n];
            item.find("input[name=pfname]").attr("value",p.fname);
            item.find("input[name=plname]").attr("value",p.lname);
            item.find("input[name=ptitle]").attr("value",p.title);
            item.find("textarea[name=pbio]").attr("value",p.bio);
            item.find("input[name=photo]").attr("value",p.photo);
            item.find("input[name=owner]").attr("value",p.owner);
            item.find("input[name=ownership_percentage]").attr("value",p.ownership_percentage);
            item.find("input[name=pedu]").attr("value",p.edu);
            item.find("input[name=pskills]").attr("value",p.skills);
            item.find("input[name=pprof]").attr("value",p.prof);
            item.find("input[name=pawards]").attr("value",p.awards);
            item.find("input[name=pcommunity]").attr("value",p.community);
            item.find("input[name=pyears]").attr("value",p.years);
            item.find("input[name=pcompensation]").attr("value",p.compensation);
        }

Post a Comment for "Problems Saving Data In Added Fields To A Javascript Form"