Error in ‘dynamic’ input data using API Action in Front-end

======== TEMPLATE BUG FORM ========

Wappler Version : 7.3x
Operating System : Win11
Server Model: Nodejs
Database Type:
Hosting Type: OwnServer

Error in ‘dynamic’ input data using API Action in Front-end

The problem is that when data is sent without dynamic input data, regardless of the variable format 'snake_case', 'camelCase' or 'pascalCase', the api sends a variable instead of the actual value.

How to reproduce

Create a new dmx-api-action:

Static Input data and Dynamic Input Data

Create api endpoint for view received input data…

So, view the ‘bugFix’ sended data in Payload:

Green circle is: default input data

Red circle is: dynamic input data

You can just use the dynamic attribute for input data, those are case sensitive.

Just remove the regular input data (dmx-param)

We will be deprecating those indeed in favor of the dynamic multi value attributes exactly for the reason you mention.

Please, review the image… I dont use dmx-param… I’m using this:

The problem is in: dmx-bind:data*

Could you paste the generated html code of the api action?

Example:

<dmx-api-action id="api1" noload="true" dmx-bind:data="{georgeWappler:`MainCookieManager.data._session_id`}" url="/api/core/test" method="post" data-type="json"></dmx-api-action>

yes that should be fine, but in your usage above you had bugfix twice, so that is why it is send twice. You should add it only in the dynamic attributes input data

George, if you can, ask someone on your team to test it. Because it doesn't work here. I've already tested it a lot!

This example here is not working:

<dmx-api-action id="api1" dmx-bind:data="{testKey:`MainCookieManager._testKey`}" method="post" url="/api/core/testing"></dmx-api-action>

It's impossible to send a data with a variable in camelCase... I'm not crazy or lost... If you can, check it or ask someone to check it. If it doesn't work anymore, please let me know.

I can confirm there's an issue with the `

Having this:

<dmx-value id="var1" dmx-bind:value="12"></dmx-value>

<dmx-api-action id="api2" method="post" url="http://localhost:5000/api/test/testapi1" dmx-bind:data="{value:`var1.value`}"></dmx-api-action>

Sends:
image

If I change directly in the code (deleting `):

<dmx-api-action id="api2" method="post" url="http://localhost:5000/api/test/testapi1" dmx-bind:data="{value:var1.value}"></dmx-api-action>

The data is correctly sended:

But dissapears from the UI:

I guess @mbsrj your solution is remove the `

So you'll have:

<dmx-api-action id="api1" dmx-bind:data="{testKey:MainCookieManager._testKey}" method="post" url="/api/core/testing"></dmx-api-action>

But won't be visible on the UI

Yes, that's the correct configuration. Thank you for your attention. Now we just have to wait for the Wappler team to update it... @George

Fixed in Wappler 7.3.3

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.