18 Replies Latest reply on Oct 30, 2007 2:30 PM by Mithrandirself

    Input Text Disapears After Entry

    Kevin1138
      Hey All,

      I am working on a project using client information. A movie clip opens on command and inside it are text input fields for First Name, Last Name, Address, Company Name, Email and Phone Number. You can enter text fine and it writes every field to the database. When you navigate away from the screen and back all the fields have stayed in place except for Address and Company Name? Any idea as to what might be causing this?

      //write out records to DB
      function write_records(): Void {
      // write out client information
      var current_client_ID = main.client_ID.text;
      var current_client_first_name = main.client_first_name.text;
      var current_client_last_name = main.client_last_name.text;
      var current_client_company = main.client_company.text;
      var current_client_address = main.client_address.text;
      var current_client_email = main.client_email.text;
      var current_client_phone = main.client_phone.text;
      var update_client_records = mdm.Database.MSAccess.runQuery("UPDATE client_info SET first_name ='"+current_client_first_name+"',last_name ='"+current_client_last_name+"',company ='"+current_client_company+"',address='"+current_client_address+"',email='"+current_clien t_email+"',phone='"+current_client_phone+"' WHERE ID = "+current_client_ID+"");




      var update_records = mdm.Database.MSAccess.connectAbs(currentPath+"\\projects\\"+project_name+"\\db\\project_d ata.mdb");
      //make record of current number of DB entries
      var current_job_records = mdm.Database.MSAccess.select("SELECT * FROM job_info");
      var update_dataSet = mdm.Database.MSAccess.getData();

      for (i=0; i < update_dataSet.length; i++){
      //don't add any record that has the delete box checked
      if (main["mc"+ i]["mc"+ i].delete_box.selected == true){
      var current_ID:Number = main["mc"+ i]["mc"+ i].ID.text;
      var delete_record = mdm.Database.MSAccess.runQuery("DELETE FROM job_info WHERE ID ="+current_ID+"");
      }
      else {
        • 1. Re: Input Text Disapears After Entry
          kglad Adobe Community Professional & MVP
          when you navigate away those two textfields no longer exist.
          • 2. Re: Input Text Disapears After Entry
            Kevin1138 Level 1
            How do I keep them existing?
            • 3. Re: Input Text Disapears After Entry
              Mithrandirself
              Hi Kevin, you mention that "First Name, Last Name, Address, Company Name, Email and Phone Number" are all present except for "Address and Company Name"

              If this is the case, it sounds like you have "something" writing those variables back to the prompts, probabaly when the movie is loaded

              I noticed that you only attached the database Writing php functions, if data is being written to your database correctly, then thats not your problem.

              It may be that you have code that takes the persons "current_client_ID" and loads the pertinent information to the input boxes. If thats so, I'd bet Address and Company Name are not a part of the list of loaded information.

              One way to possibly find this, is by taking a field that stays "First Name" for instance, and doing a search on that string on all your files that interact with the database, if you see the other fields that are present in a particular area, except for the address/company name fields, thats at least somewhere to start your debugging.
              • 4. Re: Input Text Disapears After Entry
                kglad Adobe Community Professional & MVP
                how do you keep the other textfields from being removed?
                • 5. Re: Input Text Disapears After Entry
                  Kevin1138 Level 1
                  I'm not sure, this project was handed over to me. If I could find out how those ones stayed I could figure out how to keep the rest, I think. It writes to the DB just fine and as far as I can tell the code is right for the text fields. This is everything that pertains to the text fields.

                  stop();
                  _global.currentPath = mdm.FileSystem.getCurrentDir();
                  var project_name = mdm.FileSystem.loadFile(currentPath+"master\\project_data.txt");
                  //puts existing client info in place
                  var client_info_connect = mdm.Database.MSAccess.connectAbs(currentPath+"\\projects\\"+project_name+"\\db\\project_d ata.mdb");
                  var is_connected = mdm.Database.MSAccess.success();
                  var client_info_select = mdm.Database.MSAccess.select("SELECT * FROM client_info WHERE project_name = '"+project_name+"'");
                  var client_dataSet = mdm.Database.MSAccess.getData();
                  main.client_ID.text = client_dataSet[0][0];
                  main.client_first_name.text = client_dataSet[0][1];
                  main.client_last_name.text = client_dataSet[0][2];
                  main.client_company.text = client_dataSet[0][3];
                  main.client_address.text = client_dataSet[0][4];
                  main.client_email.text = client_dataSet[0][5];
                  main.client_phone.text = client_dataSet[0][5];
                  mdm.Database.MSAccess.close();
                  //sets the title in the nav
                  main_category_text.text = "Project Setup:";
                  //connecting to the DB and the job_info table to draw contact info
                  var job_info_connect = mdm.Database.MSAccess.connectAbs(currentPath+"\\projects\\"+project_name+"\\db\\project_d ata.mdb");
                  var is_connected = mdm.Database.MSAccess.success();
                  var job_info_select = mdm.Database.MSAccess.select("SELECT * FROM job_info");
                  var dataSet = mdm.Database.MSAccess.getData();
                  //put existing data into their proper fields
                  project_title.text = project_name;
                  for (i=0; i<dataSet.length; i++) {
                  main["mc"+i].attachMovie("contact_info", ["mc"+i], main["mc"+i].getNextHighestDepth());
                  main["mc"+i]["mc"+i].ID.text = dataSet [0];
                  main["mc"+i]["mc"+i].contact_title.text = dataSet
                  [1];
                  main["mc"+i]["mc"+i].full_name.text = dataSet [2];
                  main["mc"+i]["mc"+i].address.text = dataSet
                  [3];
                  main["mc"+i]["mc"+i].email.text = dataSet [4];
                  main["mc"+i]["mc"+i].phone.text = dataSet
                  [5];
                  }
                  for (i=0; i<dataSet.length; i++) {
                  main_print["mc"+i].attachMovie("contact_info2", ["mc"+i], main["mc"+i].getNextHighestDepth());
                  main_print["mc"+i]["mc"+i].ID.text = dataSet [0];
                  main_print["mc"+i]["mc"+i].contact_title.text = dataSet
                  [1];
                  main_print["mc"+i]["mc"+i].full_name.text = dataSet [2];
                  main_print["mc"+i]["mc"+i].address.text = dataSet
                  [3];
                  main_print["mc"+i]["mc"+i].email.text = dataSet [4];
                  main_print["mc"+i]["mc"+i].phone.text = dataSet
                  [5];
                  }
                  mdm.Database.MSAccess.close();
                  //function for In Floor Heat Button
                  infloor_heat.onPress = function():Void {
                  var job_info_connect = mdm.Database.MSAccess.connectAbs(currentPath+"\\projects\\"+project_name+"\\db\\project_d ata.mdb");
                  var is_connected = mdm.Database.MSAccess.success();
                  var job_info_select = mdm.Database.MSAccess.select("SELECT * FROM job_info");
                  var dataSet2 = mdm.Database.MSAccess.getData();
                  var new_contact_count = dataSet2.length;
                  var new_ID:Number = dataSet2.length+1;
                  if (dataSet2.length<14) {
                  main["mc"+new_contact_count].attachMovie("contact_info", ["mc"+new_contact_count], main["mc"+new_contact_count].getNextHighestDepth());
                  main["mc"+new_contact_count]["mc"+new_contact_count].ID.text = new_ID;
                  main["mc"+new_contact_count]["mc"+new_contact_count].contact_title.text = "In Floor Heat Information";
                  var insert_in_floor = mdm.Database.MSAccess.runQuery("INSERT INTO job_info (title) VALUES ('In Floor Heat Information')");
                  mdm.Database.MSAccess.close();
                  } else {
                  mdm.prompt("max contact records reached");
                  }
                  };
                  //function for Lightning Control button
                  lighting_control.onPress = function():Void {
                  var job_info_connect = mdm.Database.MSAccess.connectAbs(currentPath+"\\projects\\"+project_name+"\\db\\project_d ata.mdb");
                  var is_connected = mdm.Database.MSAccess.success();
                  var job_info_select = mdm.Database.MSAccess.select("SELECT * FROM job_info");
                  var dataSet2 = mdm.Database.MSAccess.getData();
                  var new_contact_count = dataSet2.length;
                  var new_ID:Number = dataSet2.length+1;
                  if (dataSet2.length<14) {
                  main["mc"+new_contact_count].attachMovie("contact_info", ["mc"+new_contact_count], main["mc"+new_contact_count].getNextHighestDepth());
                  main["mc"+new_contact_count]["mc"+new_contact_count].ID.text = new_ID;
                  main["mc"+new_contact_count]["mc"+new_contact_count].contact_title.text = "Lighting Control";
                  var insert_in_floor = mdm.Database.MSAccess.runQuery("INSERT INTO job_info (title) VALUES ('Lighting Control')");
                  mdm.Database.MSAccess.close();
                  } else {
                  mdm.prompt("max contact records reached");
                  }
                  };
                  //loads the new job contact window movieclip on to the stage
                  add_contact_button.onRelease = function():Void {
                  job_contact_window._x = 420;
                  job_contact_window._y = 280;
                  job_contact_window.contact_name.text = "";
                  };
                  //moves the new projects box off screen on cancel
                  job_contact_window.cancel_button.onPress = function():Void {
                  job_contact_window._x = -400;
                  job_contact_window._y = -400;
                  };
                  //code for starting a new contact
                  job_contact_window.new_project_window_button.onPress = function():Void {
                  if (job_contact_window.contact_name.text == "") {
                  mdm.prompt("Please name your new contact before proceeding");
                  } else {
                  var contact_name = job_contact_window.contact_name.text;
                  var job_info_connect = mdm.Database.MSAccess.connectAbs(currentPath+"\\projects\\"+project_name+"\\db\\project_d ata.mdb");
                  var is_connected = mdm.Database.MSAccess.success();
                  var job_info_select = mdm.Database.MSAccess.select("SELECT * FROM job_info");
                  var dataSet2 = mdm.Database.MSAccess.getData();
                  var new_contact_count = dataSet2.length;
                  var new_ID:Number = dataSet2.length+1;
                  if (dataSet2.length<14) {
                  main["mc"+new_contact_count].attachMovie("contact_info", ["mc"+new_contact_count], main["mc"+new_contact_count].getNextHighestDepth());
                  //
                  main["mc"+new_contact_count]["mc"+new_contact_count].contact_title.text = contact_name;
                  main["mc"+new_contact_count]["mc"+new_contact_count].ID.text = new_ID;
                  var insert_in_floor = mdm.Database.MSAccess.runQuery("INSERT INTO job_info (title) VALUES ('"+contact_name+"')");
                  mdm.Database.MSAccess.close();
                  job_contact_window._x = -400;
                  job_contact_window._y = -400;
                  job_contact_window.contact_name.text == " ";
                  } else {
                  mdm.prompt("max contact records reached");
                  }
                  }
                  };
                  //write out records to DB
                  function write_records():Void {
                  // write out client information
                  var current_client_ID = main.client_ID.text;
                  var current_client_first_name = main.client_first_name.text;
                  var current_client_last_name = main.client_last_name.text;
                  var current_client_company = main.client_company.text;
                  var current_client_address = main.client_address.text;
                  var current_client_email = main.client_email.text;
                  var current_client_phone = main.client_phone.text;
                  var update_client_records = mdm.Database.MSAccess.runQuery("UPDATE client_info SET first_name ='"+current_client_first_name+"',last_name ='"+current_client_last_name+"',company ='"+current_client_company+"',address='"+current_client_address+"',email='"+current_clien t_email+"',phone='"+current_client_phone+"' WHERE ID = "+current_client_ID+"");
                  var update_records = mdm.Database.MSAccess.connectAbs(currentPath+"\\projects\\"+project_name+"\\db\\project_d ata.mdb");
                  //make record of current number of DB entries
                  var current_job_records = mdm.Database.MSAccess.select("SELECT * FROM job_info");
                  var update_dataSet = mdm.Database.MSAccess.getData();
                  for (i=0; i<update_dataSet.length; i++) {
                  //don't add any record that has the delete box checked
                  if (main["mc"+i]["mc"+i].delete_box.selected == true) {
                  var current_ID:Number = main["mc"+i]["mc"+i].ID.text;
                  var delete_record = mdm.Database.MSAccess.runQuery("DELETE FROM job_info WHERE ID ="+current_ID+"");
                  } else {
                  // then write out on screen info to DB
                  var current_ID:Number = main["mc"+i]["mc"+i].ID.text;
                  var new_current_ID:Number = current_ID+1;
                  var current_contact_title = main["mc"+i]["mc"+i].contact_title.text;
                  var current_full_name = main["mc"+i]["mc"+i].full_name.text;
                  var current_address = main["mc"+i]["mc"+i].address.text;
                  var current_email = main["mc"+i]["mc"+i].email.text;
                  var current_phone = main["mc"+i]["mc"+i].phone.text;
                  var update_records = mdm.Database.MSAccess.runQuery("UPDATE job_info SET title ='"+current_contact_title+"',name ='"+current_full_name+"',address='"+current_address+"',email='"+current_email+"',phone='" +current_phone+"' WHERE ID = "+current_ID+"");
                  • 6. Re: Input Text Disapears After Entry
                    kglad Adobe Community Professional & MVP
                    use the attach code option to display actionscript. otherwise, your code is very difficult to read.

                    nevertheless, the lines below (if they are on the same frame that you return to when find the address and company name textfields are not populated) should refresh the text in your address and company name textfields IF the client_dataSet array were populated (whether those textfields were removed or not):

                    • 7. Re: Input Text Disapears After Entry
                      Mithrandirself Level 1
                      There looks like there are 2 places that this could possibly be occuring. First is when the data is being pulled in from the database and stored in temp variables, second is when those temp variables are being sent to a flash movie.

                      ======
                      store database information in temp variables
                      ======
                      var client_info_select = mdm.Database.MSAccess.select("SELECT * FROM client_info WHERE project_name = '"+project_name+"'");
                      -----
                      is the above sql query pulling in the address and company name data?
                      -----
                      var client_dataSet = mdm.Database.MSAccess.getData();
                      -----
                      dataSet[][] seems to be the temp variable in which all the information you want is stored, is the information you need present at this time?
                      -----
                      main.client_ID.text = client_dataSet[0][0];
                      main.client_first_name.text = client_dataSet[0][1];
                      main.client_last_name.text = client_dataSet[0][2];
                      main.client_company.text = client_dataSet[0][3];
                      main.client_address.text = client_dataSet[0][4];
                      main.client_email.text = client_dataSet[0][5];
                      main.client_phone.text = client_dataSet[0][5];
                      mdm.Database.MSAccess.close();
                      -----
                      By this time not only should the address/company name be in dataSet[][] but it should also be in their own explicit
                      main.client_address.text and main.client_company.text fields
                      -----

                      =====
                      2nd possible problem area, For starters, it seems like this same loop is being run twice, I don't see any need for it to be run twice. Might be worthwhile looking into that
                      =====
                      var job_info_select = mdm.Database.MSAccess.select("SELECT * FROM job_info");
                      -----
                      Again, I'd check the contents of this selection directly against the database, make sure the format and contents are
                      what you expect to see
                      -----
                      var dataSet = mdm.Database.MSAccess.getData();
                      //put existing data into their proper fields
                      project_title.text = project_name;
                      -----
                      at this point the variable dataSet[] should have the contents of: "SELECT * FROM job_info"
                      -----
                      for (i=0; i<dataSet.length; i++) {
                      main["mc"+i].attachMovie("contact_info", ["mc"+i], main["mc"+i].getNextHighestDepth());
                      main["mc"+i]["mc"+i].ID.text = dataSet[0];
                      main["mc"+i]["mc"+i].contact_title.text = dataSet[1];
                      main["mc"+i]["mc"+i].full_name.text = dataSet[2];
                      main["mc"+i]["mc"+i].address.text = dataSet[3];
                      -----
                      does dataSet[3] actually contain address information?
                      I notice there is no company name.text you may have to add it here
                      main["mc"+i]["mc"+i].company.text = dataSet[????]

                      in my opinion this is the most likely spot where you are running into trouble.
                      -----
                      main["mc"+i]["mc"+i].email.text = dataSet[4];
                      main["mc"+i]["mc"+i].phone.text = dataSet[5];
                      }



                      I'd focus on those two area's and verify that the data you would expect to show up is infact showing up. If it is not, you can then see if its because your sql query is not returning the correct information, or perhaps the values in dataSet are not being assigned to the correct Flash Variable names.

                      Either way, interesting code, I hope that helps!
                      • 8. Re: Input Text Disapears After Entry
                        Kevin1138 Level 1
                        The first part has all the info in place in the DataBase and the other fields filled out in Flash. The code repeats because there are other contact windows that open below the main one, only slightly different. IE no company name.
                        • 9. Re: Input Text Disapears After Entry
                          Kevin1138 Level 1
                          var client_info_select = mdm.Database.MSAccess.select("SELECT * FROM client_info WHERE project_name = '"+project_name+"'");
                          -----
                          is the above sql query pulling in the address and company name data?

                          In theory it should be, shouldn't it? It is pulling from the DB but not the address or company name.
                          • 10. Re: Input Text Disapears After Entry
                            Kevin1138 Level 1
                            And this is all being tested in Zinc, that is where I see the problem.
                            • 11. Input Text Disapears After Entry
                              Mithrandirself Level 1
                              My meaning was that even if it "should" be pulling something, if it is not working you should check it directly. Take the sql query, and access the database directly, make sure that the selection returns the data values you expected.

                              In particular the data stored in (client_dataSet[][]) and (dataSet[]) needs to be verified. send it to the screen, or dump it to a text file etc, Whenever a large chunk of code looks like it should be working, but is not, it is good practice to validate the data you are pulling from the database and see where the expected values either go wrong or just go away.

                              IE. put a trace in your for loop at the end, to see whats in all the data variables
                              trace(i+" 0:"+dataSet[0]+" 1:"+dataSet[1]+" 2:"+dataSet[2]+" 3:"+dataSet[3]+" 4:"+dataSet[4]+" 5:"+dataSet[5]);


                              if all the database data is correct and in the right places, then you can be pretty confident that the problem has to do with assignment to your objects, not the database connection or the data pulled from the connection.
                              • 12. Re: Input Text Disapears After Entry
                                Kevin1138 Level 1
                                I'm pretty sure the code is right for that. I just don't know what it could be besides that, if it is just something silly in Flash or if things are named wrong or if it is a problem when I run it through ZINC.
                                • 13. Re: Input Text Disapears After Entry
                                  Kevin1138 Level 1
                                  Thanks for all of your help but I still cannot get this to work. I'm not sure where else to turn on this. Here is the code attached properly. Somebody suggested it might be an issue with the font itself but I can't seem to make that work either.
                                  • 14. Re: Input Text Disapears After Entry
                                    Mithrandirself Level 1
                                    Were you able to verify the data stored in dataSet[3] and client_dataSet[0][4]?

                                    When you run the program, if you send those values to trace
                                    trace(dataSet[3]);
                                    trace(client_dataSet[0][4]);
                                    trace(dataSet [3]);

                                    what is returned?

                                    it will be impossible to debug the code if the correct data isn't in dataSet in the first place.
                                    • 15. Re: Input Text Disapears After Entry
                                      Kevin1138 Level 1
                                      Everything is set. That information is verified. I'm clueless.
                                      • 16. Re: Input Text Disapears After Entry
                                        Mithrandirself Level 1
                                        Good, so the first step is done, we know that your database is pulling the correct information, and that at the very least, we have everything you need in the variables dataSet[] and dataSet[][]

                                        So, if its not the initialization of database data to temp variables, we go to the next likely culprit, the assignment. Heres what I would like you to do, at every point where dataSet[] and dataSet[][] are assigned to an object, I want you to comment out that line, and instead put hardcoded text in its place, each line needs to be unique, that way you can see exactly which lines are being used to populate information on the screen. for instance:

                                        //for (i=0; i<dataSet.length; i++) {
                                        // main["mc"+i].attachMovie("contact_info", ["mc"+i], //main["mc"+i].getNextHighestDepth());
                                        // main["mc"+i]["mc"+i].ID.text = dataSet[0];
                                        // main["mc"+i]["mc"+i].contact_title.text = dataSet[1];
                                        // main["mc"+i]["mc"+i].full_name.text = dataSet[2];
                                        // main["mc"+i]["mc"+i].address.text = dataSet[3];
                                        // main["mc"+i]["mc"+i].email.text = dataSet[4];
                                        // main["mc"+i]["mc"+i].phone.text = dataSet[5];
                                        //}

                                        for (i=0; i<dataSet.length; i++) {
                                        main["mc"+i].attachMovie("contact_info", ["mc"+i], main["mc"+i].getNextHighestDepth());
                                        main["mc"+i]["mc"+i].ID.text = "0 dataSet[0]";
                                        main["mc"+i]["mc"+i].contact_title.text = "1 dataSet[1]";
                                        main["mc"+i]["mc"+i].full_name.text = "2 dataSet[2]";
                                        main["mc"+i]["mc"+i].address.text = "3 dataSet[3]";
                                        main["mc"+i]["mc"+i].email.text = "4 dataSet[4]";
                                        main["mc"+i]["mc"+i].phone.text = "5 dataSet[5]";
                                        }

                                        Remember for following blocks you will need to supply unique hardcoded values so the next dataset should be : "6 dataSet[0]" then "7 dataSet[1]" etc

                                        do this for every instance where dataset is being assigned to a text property of an object. then run your program, see which data entries are displayed, this will tell you Exactly where the assignment is occuring.

                                        Once we know exactly where the assignment is occuring, we can check to make sure the object for address is being referenced correctly and run some other tests.
                                        • 17. Re: Input Text Disapears After Entry
                                          Kevin1138 Level 1
                                          Ok, after I did that, when I run it it displays the following in the catagories.

                                          Address: 4 client_dataSet[0][4]

                                          and for the second place it exists:

                                          Address: 3 dataSet [3]
                                          • 18. Input Text Disapears After Entry
                                            Mithrandirself Level 1
                                            Now thats surprizing.

                                            The only thing I can think of at this time is that perhaps the data type of the resultant of dataSet[3] and client_dataSet[0][4] are not compatible with the expected data type in the containers.

                                            lets try concatinating a string to the dataSet values.

                                            Instead of:

                                            "4 client_dataSet[0][4]"
                                            "3 dataSet[3]"

                                            try:

                                            "4 start "+client_dataSet[0][4]+"4 end"
                                            "3 start "+dataSet[3]+"3 end"

                                            I have a feeling those prompts will return:

                                            4 start 4 end
                                            3 start 3 end

                                            (either that or it will be totally blank)

                                            Which means that somehow dataSet[3] and dataSet[0][4] are either somehow being deleted at the time of assignment, or they were never filled to begin with. Or they are not considered a compatible data type, and you may have to use some sort of ToString() function (sorry I don't know the syntax for flashes string converting programs)