POST variables not auto created

I have failed now for a solid week since updating to 2.7.1 & 2.7.2 to create a simple Insert form to a localhost database table.

Since Visual Queries Using Tags has been introduced is when my problem started.

I go through the same steps I am used to but after creating the database connection steps, seeing the correct insert query in my insert query properties, & seeing that all necessary steps are saved in
dmxConnect/api/my_server_connection_folder/my_named_connection_action.php.

In the right side App Structure panel I create a server connect and select the server action I created for this form.

Here is the Server connection file with all the necessary code to connect to my database & insert all fields of my form into the proper table.

But I never SEE this query in this file when I try to either use the Bootstrap 4 Table or Form Generator.

the Data bindings panel does not show the Data with each field value visible

All I get is the query action file name

Here is where it should be picking up the query values for the Data Bindings panel after I select the Server Action file.

    <?php
require('../../../dmxConnectLib/dmxConnect.php');


$app = new \lib\App();

$app->define(<<<'JSON'
{
  "settings": {
    "options": {}
  },
  "meta": {
    "options": {},
    "$_POST": [
      {
        "type": "text",
        "name": "url"
      },
      {
        "type": "text",
        "name": "notes"
      }
    ]
  },
  "exec": {
    "steps": [
      "Connections/connection_for_urls",
      {
        "name": "inserturls_query",
        "module": "dbupdater",
        "action": "insert",
        "options": {
          "connection": "connection_for_urls",
          "sql": {
            "type": "insert",
            "values": [
              {
                "table": "myurls",
                "column": "url",
                "type": "text",
                "value": "{{$_POST.url}}"
              },
              {
                "table": "myurls",
                "column": "domain-hosting",
                "type": "text",
                "value": "{{$_POST[\"domain-hosting\"]}}"
              },
              {
                "table": "myurls",
                "column": "registration-master",
                "type": "text",
                "value": "{{$_POST[\"registration-master\"]}}"
              },
              {
                "table": "myurls",
                "column": "domain-expiration",
                "type": "date",
                "value": "{{$_POST[\"domain-expiration\"]}}"
              },
              {
                "table": "myurls",
                "column": "registration-primary",
                "type": "text",
                "value": "{{$_POST[\"registration-primary\"]}}"
              },
              {
                "table": "myurls",
                "column": "username-wordpress",
                "type": "text",
                "value": "{{$_POST[\"username-wordpress\"]}}"
              },
              {
                "table": "myurls",
                "column": "password-wordpress",
                "type": "text",
                "value": "{{$_POST[\"password-wordpress\"]}}"
              },
              {
                "table": "myurls",
                "column": "myusername-app",
                "type": "text",
                "value": "{{$_POST[\"myusername-app\"]}}"
              },
              {
                "table": "myurls",
                "column": "mypassword-app",
                "type": "text",
                "value": "{{$_POST[\"mypassword-app\"]}}"
              },
              {
                "table": "myurls",
                "column": "my-email",
                "type": "text",
                "value": "{{$_POST[\"my-email\"]}}"
              },
              {
                "table": "myurls",
                "column": "registration-secondary",
                "type": "text",
                "value": "{{$_POST[\"registration-secondary\"]}}"
              },
              {
                "table": "myurls",
                "column": "user-username",
                "type": "text",
                "value": "{{$_POST[\"user-username\"]}}"
              },
              {
                "table": "myurls",
                "column": "user-password",
                "type": "text",
                "value": "{{$_POST[\"user-password\"]}}"
              },
              {
                "table": "myurls",
                "column": "user-email",
                "type": "text",
                "value": "{{$_POST[\"user-email\"]}}"
              },
              {
                "table": "myurls",
                "column": "notes",
                "type": "text",
                "value": "{{$_POST.notes}}"
              },
              {
                "table": "myurls",
                "column": "record-creation",
                "type": "datetime",
                "value": "{{$_POST[\"record-creation\"]}}"
              },
              {
                "table": "myurls",
                "column": "record-update",
                "type": "datetime",
                "value": "{{$_POST[\"record-update\"]}}"
              }
            ],
            "table": "myurls",
            "query": "INSERT INTO myurls\n(url, \"domain-hosting\", \"registration-master\", \"domain-expiration\", \"registration-primary\", \"username-wordpress\", \"password-wordpress\", \"myusername-app\", \"mypassword-app\", \"my-email\", \"registration-secondary\", \"user-username\", \"user-password\", \"user-email\", notes, \"record-creation\", \"record-update\") VALUES (:P1 /* {{$_POST.url}} */, :P2 /* {{$_POST[\"domain-hosting\"]}} */, :P3 /* {{$_POST[\"registration-master\"]}} */, :P4 /* {{$_POST[\"domain-expiration\"]}} */, :P5 /* {{$_POST[\"registration-primary\"]}} */, :P6 /* {{$_POST[\"username-wordpress\"]}} */, :P7 /* {{$_POST[\"password-wordpress\"]}} */, :P8 /* {{$_POST[\"myusername-app\"]}} */, :P9 /* {{$_POST[\"mypassword-app\"]}} */, :P10 /* {{$_POST[\"my-email\"]}} */, :P11 /* {{$_POST[\"registration-secondary\"]}} */, :P12 /* {{$_POST[\"user-username\"]}} */, :P13 /* {{$_POST[\"user-password\"]}} */, :P14 /* {{$_POST[\"user-email\"]}} */, :P15 /* {{$_POST.notes}} */, :P16 /* {{$_POST[\"record-creation\"]}} */, :P17 /* {{$_POST[\"record-update\"]}} */)",
            "params": [
              {
                "name": ":P1",
                "type": "expression",
                "value": "{{$_POST.url}}"
              },
              {
                "name": ":P2",
                "type": "expression",
                "value": "{{$_POST[\"domain-hosting\"]}}"
              },
              {
                "name": ":P3",
                "type": "expression",
                "value": "{{$_POST[\"registration-master\"]}}"
              },
              {
                "name": ":P4",
                "type": "expression",
                "value": "{{$_POST[\"domain-expiration\"]}}"
              },
              {
                "name": ":P5",
                "type": "expression",
                "value": "{{$_POST[\"registration-primary\"]}}"
              },
              {
                "name": ":P6",
                "type": "expression",
                "value": "{{$_POST[\"username-wordpress\"]}}"
              },
              {
                "name": ":P7",
                "type": "expression",
                "value": "{{$_POST[\"password-wordpress\"]}}"
              },
              {
                "name": ":P8",
                "type": "expression",
                "value": "{{$_POST[\"myusername-app\"]}}"
              },
              {
                "name": ":P9",
                "type": "expression",
                "value": "{{$_POST[\"mypassword-app\"]}}"
              },
              {
                "name": ":P10",
                "type": "expression",
                "value": "{{$_POST[\"my-email\"]}}"
              },
              {
                "name": ":P11",
                "type": "expression",
                "value": "{{$_POST[\"registration-secondary\"]}}"
              },
              {
                "name": ":P12",
                "type": "expression",
                "value": "{{$_POST[\"user-username\"]}}"
              },
              {
                "name": ":P13",
                "type": "expression",
                "value": "{{$_POST[\"user-password\"]}}"
              },
              {
                "name": ":P14",
                "type": "expression",
                "value": "{{$_POST[\"user-email\"]}}"
              },
              {
                "name": ":P15",
                "type": "expression",
                "value": "{{$_POST.notes}}"
              },
              {
                "name": ":P16",
                "type": "expression",
                "value": "{{$_POST[\"record-creation\"]}}"
              },
              {
                "name": ":P17",
                "type": "expression",
                "value": "{{$_POST[\"record-update\"]}}"
              }
            ]
          }
        },
        "meta": [
          {
            "name": "identity",
            "type": "text"
          },
          {
            "name": "affected",
            "type": "number"
          }
        ],
        "output": true
      }
    ]
  }
}
JSON
);
?>

I have tried tests with selecting a data query on my page instead of a Form generator but still I can’t get a Data Field output when I select the Server Action – the ONLY server action i have created in this project.

Since the new Visual Query builder with Tags what has changed?

Your explanation is a little unclear.
Can you try to explain what your issue is a bit simpler? Is it that an insert record form is not inserting records in a database?
Or is the problem that you don’t know how to generate an insert record form?

Since Visual Queries Using Tags has been introduced is when my problem started.

I go through the same steps I am used to

After I create my query, having chosen an INSERT to DATABASE action,
I see the VALIDATION that what I wanted to do is, as before over the past few months, seems to be Good to Go

I SAVE all files – get notification that all is saved.

The file I posted in my previous post is what Wappler Produced. It looks okay.

But when I go over to the APP STRUCTURES

I cannot retrieve the Data that the Wappler file is set up to retrieve from that file.

I want to create a Form that duplicates all of the database fields AVAILABLE to save data into.

It should read them first to create the Form – as I am USED TO seeing.

I still don’t understand your explanation and some of the terms you are using to describe what you are doing.

Can you just answer my question shortly:
Is the problem you are having, that when you open the Form Generator and select the insert record action, your POST variables (i.e. form inputs) don’t get created?

Correct

Just tested this and i see not issues:

Thank you, Teodor

You are correct. You do not see any problems.
I agree that you don’t see any problems where you are sitting.

But when I get to Selecting a Server Action as you show and I select the appropriate “insert” action that Wappler created after I saved the Connection and Query action – that is where I do not get all of the fields in that query.

Instead I get what I have posted.

https://community.wappler.io/uploads/default/original/3X/7/7/778c7692beb3a29731956c61ed8d86df6d7e2d59.png

I included above that exact file of that action – my own insert action.

I wanted someone to read it and see if there is some obvious flaw that prevents Wappler from reading it and performing it — some clue as to why it only produces the fields I have shown.

This is what I get at the point of Server Action after choosing Generators
Bootstrap 4 Form Generator

When you save your server action, are there any POST variable generated under Globals > $_POST?

Yes Indeed!

They don’t seem to get generated. You have many input in the insert step, from what i see on the screenshot.

Counting id auto-generate primary field I have 18 fields in that table, none of them Required.

Teodor,
What do you mean by

They don’t seem to get generated

I DELETED those two Globals to see what i would get when I tried the Bootstrap 4 Generator again and i got this error

@NewMedia …
There should be POST vars created for ALL the fields which are added to the insert record step:

Please create your insert record server action from scratch and see if the POST vars are geneareted under GLOBALS > $_POST

I have tried multiple times

All new connections 3 times

then I try the Bootstrap 4 Form Generator and get the same result as soon as I select the new connection and insert action.

There seems to be an issue with the - used in your column names. They don’t seem to be imported under POST variables so that’s why they don’t appear in the form generator.

We will try to improve this for the next update, but in general i’d suggest avoid using hyphenns - in the table names and table column names.
Either use underscores _ like my_column_name or use camelcase myColumnName - hyphens and spaces are not a good idea.

1 Like

That’s probably it.

I made a whole new table – a subset of the original-- and deleted columns until it only had 7 columns.

i had tried this because sometimes I get a database naming structure where I can change quirky column names from Excel
and I always used UNDERLINE _ to separate text in a column name.

But in a few times the client wants a direct database export and wants a straight into Excel column name to match internal house records.

Since PHP doesn’t usually have a problem with less than Best Practices for naming mysql columns I thought that since mysql accepted hyphens in column names i might just leave it as is.

I’ll try this with the Best Practices _ underline for coumn names.

Hopefully, I’ll won’t be back, Teodor!

Thank you for helping me troubleshoot this!

Much appreciation to you!

The whole issue was caused by giving mysql column names hyphens instead of Underlines _ ALWAYS.

Now Wappler is doing its thing Correctly, as I’m used to!

My Bootstrap form generator works perfectly!

Thank you for your insight, Teodor! :grin:

1 Like