3 Replies Latest reply on Aug 14, 2009 4:04 AM by loquela

    Error tNG_fields.getColumnType:

      I'm trying to build an insert record form and I keep getting this message when I submit the form:
      Column username is not part of the current transaction.

      username is not a field in this form. it is a field in the database but it's set to NULL. I don't understand what this message is telling me.
      Any help is appreciated.

      Here is the code:
      // Load the common classes

      // Load the tNG classes

      // Make a transaction dispatcher instance
      $tNGs = new tNG_dispatcher("");

      // Make unified connection variable
      $conn_seeduser = new KT_connection($seeduser, $database_seeduser);

      // Start trigger
      $formValidation = new tNG_FormValidation();
      $formValidation->addField("First_Name", true, "text", "", "", "", "Please enter your first name.");
      $formValidation->addField("Last_Name", true, "text", "", "", "", "Please enter your last name.");
      $formValidation->addField("email", true, "text", "email", "", "", "Please enter a valid email address.");
      // End trigger

      if (!function_exists("GetSQLValueString")) {
      function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
      $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

      $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

      switch ($theType) {
      case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      case "long":
      case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      case "double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      return $theValue;

      mysql_select_db($database_seeduser, $seeduser);
      $query_get_orgtype = "SELECT * FROM org_type ORDER BY org_type.org_type_id";
      $get_orgtype = mysql_query($query_get_orgtype, $seeduser) or die(mysql_error());
      $row_get_orgtype = mysql_fetch_assoc($get_orgtype);
      $totalRows_get_orgtype = mysql_num_rows($get_orgtype);

      // Make an insert transaction instance
      $ins_contact = new tNG_insert($conn_seeduser);
      // Register triggers
      $ins_contact->registerTrigger("STARTER", "Trigger_Default_Starter", 1, "POST", "KT_Insert1");
      $ins_contact->registerTrigger("BEFORE", "Trigger_Default_FormValidation", 10, $formValidation);
      $ins_contact->registerTrigger("END", "Trigger_Default_Redirect", 99, "contact_thanks.php");
      // Add columns
      $ins_contact->addColumn("First_Name", "STRING_TYPE", "POST", "First_Name");
      $ins_contact->addColumn("Last_Name", "STRING_TYPE", "POST", "Last_Name");
      $ins_contact->addColumn("Title", "STRING_TYPE", "POST", "Title");
      $ins_contact->addColumn("org_name", "STRING_TYPE", "POST", "org_name");
      $ins_contact->addColumn("org_type", "STRING_TYPE", "POST", "org_type");
      $ins_contact->addColumn("org_other", "STRING_TYPE", "POST", "org_other");
      $ins_contact->addColumn("email", "STRING_TYPE", "POST", "email");
      $ins_contact->addColumn("Address1", "STRING_TYPE", "POST", "Address1");
      $ins_contact->addColumn("Address2", "STRING_TYPE", "POST", "Address2");
      $ins_contact->addColumn("City", "STRING_TYPE", "POST", "City");
      $ins_contact->addColumn("State", "STRING_TYPE", "POST", "State");
      $ins_contact->addColumn("Zip", "STRING_TYPE", "POST", "Zip");
      $ins_contact->addColumn("Country", "STRING_TYPE", "POST", "Country");
      $ins_contact->addColumn("Direct_phone", "STRING_TYPE", "POST", "Direct_phone");
        • 1. Re: Error tNG_fields.getColumnType:
          It;s something like it starts writing to db contact table but encounters field username, and doesn't know what to write in it, since nothing was told about it. you can add username in form as a hidden field, that way, it will get null value.

          more solution may come from others.
          • 2. Re: Error tNG_fields.getColumnType:
            Günter Schenk Level 4
            Hi Saini,

            no solution, but...

            ...and doesn't know what to write in it, since nothing was told about it

            I don´t think this is part of the problem. I´ve built heaps of "Insert Record" forms which insert stuff into just a subset of all available columns, and that always worked. If a column isn´t declared in ADDT´s...

            $ins_tablename->addColumn("column_name", "STRING_TYPE", "POST", "field_name");

            ...array, it´s getting ignored and will not be part of the transaction.

            Günter Schenk
            Adobe Community Expert, Dreamweaver
            • 3. Re: Error tNG_fields.getColumnType:

              I'm was having the same problem.


              What I thik is happening is that you are trying to insert into a table that you have set up as the default login table in your login setting so somehow ADDT is trying to insert $tNG_login_config["user_field"] automatically.


              The way around this is to add the username field as a hidden field for this particular insert form.


              If you are trying to build a registration form then I suggest you just use the registration wizard.