500 Server error on insert form

I have done dozens of insert forms with no problem. However I have a very simple insert form that does not submit and throws a 500 Server error.

<form id="formAddComment" method="post" is="dmx-serverconnect-form" action="dmxConnect/api/employers/profile/forms/addcomments.php" dmx-on:success="commentsshortlist.load({});commentsfulllist.load({})">
                    <div class="form-group">
                      <input type="hidden" class="form-control" id="hiddenempidcomments" name="hiddenempidcomments" aria-describedby="input4_help" placeholder="Enter some text" dmx-bind:value="query.profile">
                    <div class="form-group">
                      <input type="hidden" class="form-control" id="hiddencommentsstafffirts" name="hiddencommentsstafffirts" aria-describedby="input3_help" placeholder="Enter some text" dmx-bind:value="userdetails.data.query1[0].staffFirst">
                    <div class="form-group">
                      <input type="hidden" class="form-control" id="hiddencommentsstafflast" name="hiddencommentsstafflast" aria-describedby="input2_help" placeholder="Enter some text" dmx-bind:value="userdetails.data.query1[0].staffLast">
                    <div class="form-group">
                      <input type="hidden" class="form-control" id="hiddencommentsdate" name="hiddencommentsdate" aria-describedby="input1_help" placeholder="Enter some text" dmx-bind:value="var1.datetime.formatDate(&quot;yyyy-MM-dd&quot;)">
                    <div class="form-group">
                      <textarea id="textareaEmployerComment" class="form-control" required=""></textarea>
                    <button class="btn btn-warning btn-sm btn-block" type="submit">Add Comment</button>

Brad, please report the error as explained here: Debugging Problems

Looks like it is not recognizing what is typed in the textarea?

So when I remove the textarea from the form it submits fine. What is wrong with my textarea?

Your textarea is missing the name attribute, so it doesn’t submit

1 Like

Oh my god! I've been working on this for three days and that's all it was. Thank you so much Patrick.

Can't believe I missed that. :flushed:

Hello all

I am having this error too after following the doc step-by-step: https://docs.wappler.io/t/insert-database-record/2863

Here is what I am see while debugging:

{"code":"23000","file":"C:\\MAMP\\htdocs\\paper-trader\\dmxConnectLib\\lib\\db\\Connection.php","line":88,"message":"SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'ticker' cannot be null","trace":"#0 C:\\MAMP\\htdocs\\paper-trader\\dmxConnectLib\\lib\\db\\Connection.php(88): PDOStatement->execute()\n#1 C:\\MAMP\\htdocs\\paper-trader\\dmxConnectLib\\modules\\dbupdater.php(38): lib\\db\\Connection->execute('INSERT INTO `ti...', Array)\n#2 C:\\MAMP\\htdocs\\paper-trader\\dmxConnectLib\\lib\\App.php(159): modules\\dbupdater->insert(Object(stdClass), 'insert1')\n#3 C:\\MAMP\\htdocs\\paper-trader\\dmxConnectLib\\lib\\App.php(128): lib\\App->execSteps(Object(stdClass))\n#4 C:\\MAMP\\htdocs\\paper-trader\\dmxConnectLib\\lib\\App.php(98): lib\\App->execSteps(Array)\n#5 C:\\MAMP\\htdocs\\paper-trader\\dmxConnectLib\\lib\\App.php(71): lib\\App->exec(Object(stdClass))\n#6 C:\\MAMP\\htdocs\\paper-trader\\dmxConnect\\api\\database\\insert_symbol.php(8): lib\\App->define(Object(stdClass))\n#7 {main}"}

Table structure:

So I wanted to share the solution I arrived at after hours of troubleshooting (please try not to take that as an indication of my intelligence, but rather, my determination…:joy:)

I had to check No Auto Load because the Server Connect Action was running even before I submitted the form, and my table structure for this column was configured to not allow NULL values, therefore it was failing because it didn’t have any value in the {{$_POST.ticker}} variable yet!


Lastly, I will note, however, that the Dynamic Event I set on the Server Connect to reset the Server Connect form was not working, even though my database record was being inserted successfully:


So what I realized after 6 more hours of debugging (just kidding) is that the Dynamic Event should actually be set on the Form:serverconnectform1 if you used the Bootstrap 4 Form Generator as the documentation recommends. I mistakenly added the Server Connect component separately which was unnecessary.


Yes, the conhection would run without no load checked. HOWEVER you do nor need that connection at all, the save server action can be linked directly from the form settings

Hi Brian (@Hyperbytes), yes, I came to realize that with a little more experimentation Thank you for pointing that out!

we tend to recognise these little mistakes as we all made them when lesrning. it"s just i am 7 months ahead of you!