Asp.net: Error submitting form

Without a link it’s hard to say but to me it looks like you have a space in your file names/routes or Server Connect.

This is just on my local machine, so don’t know how to get you a link, but here is a snip of the console.
Hovering over the network name, you can see the url:


I checked all my routes and deleted the Server connect and recreated it, but it didn’t make any difference.

Here is a snip of the Headers:

What is the process of getting help for this? I’m spinning my wheels and not getting anywhere.
Created another list and form on a completely different table and getting the same error.

How are you submitting your form?

Is it a server connect form you are using?

Yes, it’s a server connect form. I tried changing it to an API form, but that didn’t make any difference.

I’m submitting it by calling the submit method of the form from a button.

Please post the code Wappler made for your form.

Best way to get answers is with either giving a link to the page you are working on so we can see, or to post the code that wappler generates for the module you are having an issue with, or if you prefer to screenshot parts of the GUI that are relevant, that also helps, but is more work for you to post.

May be worth while investing a small amount on a tiny development hosting account so you are working live and can post links

Thanks all for your reply. Good things to know @psweb, I’ll keep that in mind going forward.

In the mean time, is this the code you’re referring to:

<form is="dmx-serverconnect-form" id="form_edit_employee" method="post" action="/dmxConnect/api/timeclock/employees.aspx" dmx-generator="bootstrap4" dmx-form-type="horizontal" dmx-populate="dd_employees.data"
            dmx-on:success="run({'toast.show':{message:'Employee saved successfully!',title:'Save Employee'}})" dmx-on:error="run({'toast.show':{message:'Save Employee failed!',title:'Save Employee',subtitle:`sc_employees.lastError.message`}})">
           <div class="form-group row">
              <label for="inp_Id" class="col-sm-2 col-form-label">Id</label>
              <div class="col-sm-10">
                <input type="text" class="form-control" id="inp_Id" name="Id" dmx-bind:value="dd_employees.data.Id" aria-describedby="inp_Id_help" placeholder="<auto>" readonly="true">
              </div>
            </div>
            <div class="form-group row">
              <label for="inp_GivenName" class="col-sm-2 col-form-label">Given name</label>
              <div class="col-sm-10">
                <input type="text" class="form-control" id="inp_GivenName" name="GivenName" dmx-bind:value="dd_employees.data.GivenName" aria-describedby="inp_GivenName_help" placeholder="Enter Given name">
              </div>
            </div><div class="form-group row">
              <label for="inp_FamilyName" class="col-sm-2 col-form-label">Family name</label>
              <div class="col-sm-10">
                <input type="text" class="form-control" id="inp_FamilyName" name="FamilyName" dmx-bind:value="dd_employees.data.FamilyName" aria-describedby="inp_FamilyName_help" placeholder="Enter Family name">
              </div>
            <div class="form-group row">
              <label for="inp_BirthDate" class="col-sm-2 col-form-label">Birthdate</label>
              <div class="col-sm-10">
                <input type="date" class="form-control" id="inp_BirthDate" name="BirthDate" dmx-bind:value="dd_employees.data.BirthDate" aria-describedby="inp_BirthDate_help" placeholder="Enter Birthdate">
              </div>
            </div>
</form>

To keep it simple, I just included a couple of the fields. The Save button calls the forms .submit() method.

Let me know if you’d like to see anything else.

Yes that helps, so far that looks fine to me, can you show me your submit button code please.

Also could be handy to see a screenshot of your server action for this.

The form is in a modal popup and the button is in the modal footer. It checks the Id field and if it’s null, it sets the ‘action’ field to ‘insert’, otherwise it sets it to ‘update’, then submits the form and then calls the server connect refresh. The server action, then looks for the action value and acts accordingly.

          <button type="button" class="btn btn-primary"
            dmx-on:click="run([{condition:{if:`(modal_edit_employee.form_edit_employee.inp_Id.value == null)`,then:{steps:{run:{action:`modal_edit_employee.form_edit_employee.inp_action.setValue(\'insert\')`}}},else:{steps:{run:{action:`modal_edit_employee.form_edit_employee.inp_action.setValue(\'update\')`}}}}},{run:{action:`modal_edit_employee.form_edit_employee.submit();modal_edit_employee.hide();sc_employees.load({offset: query.offset, limit: query.limit, sort: query.sort, dir: query.dir, action: \'list\'},true)`}}])">Save
            changes</button>

Here is a screenshot of the server action, with the ‘update’ action expanded:

Just out of interest have you attempted with just a very simple form to make sure it works correctly and saves the info to your database.

At least that way we can be sure its all working on the environment before we try break down into all this complexity.

I will admit, with a form like this not working, we may just need a live testing environment so we can look at the link to see whats going on.

I just did that, created a new table and form with just 3 fields, but getting the same error.
Here’s the error in the console, under headers:


You can see the URL has an object in it for some reason. The form data is at the bottom along with the ‘action’ value and that all looks good, I think.

Is there anyway you can make sure that the .js file it is looking for is actually uploaded to your localhost server directory. Otherwise maybe @Teodor could take a little look.

Where is your action input located? Can you try to rename that input to an other name.

It’s just a hidden input on the form. I’ll try renaming it.

I think that’s it! I’m not getting that error now, but it’s not inserting any records yet. Are there any other naming caveats? I renamed it to: server_action but now getting a 500 Internal Server error.

See how to find out about the real error:

In general do not try to make a single server connect action with many complex cases - but use a separate server action for each action type.

OK! It’s working now! Had to rename some things that had changed, obviously, but I think we’re good. I’ve learned a lot through this and I thank everyone for your input. I’ll have to take some time and go through it in more detail. I marked @patrick’s answer as the solution!

Regards, Dan

1 Like