Join the Webstudio community

Updated 2 months ago

Issues with form POST

At a glance

The community member has created a resource that posts to their database, and they have added a form to their page that submits values to system variables. However, they are having trouble getting the title from the form to render in the POST body. The comments suggest that the community member should use binding on the resource body with the object, and specify title: system.search.title. The community member confirms that this solution worked for them.

I've created a resource that pots to my database (this works if I hardcode values).

I've added a form to my page and have it submitting my value to the system variables correctly. Here's an example:
{
"params": {},
"search": {
"title": "matrix"
},
"origin": "mysite.com"
}

My POST body is:
{
"documentId": "unique()",
"data": {
"title": "{{ search.title }}"
}
}

I've tried multiple ways to get the title to be the title I filled in. I can only get strings of my body input to render, not the actual title.
Attachment
CleanShot_2024-11-01_at_20.27.132x.png
B
J
6 comments
If you want to update search param, form should have get method
@TrySound, is this what you mean? (the second image is the actual <form> properties.
Attachments
CleanShot_2024-11-02_at_09.09.342x.png
CleanShot_2024-11-02_at_09.10.362x.png
Ah, no. Post is fine I think
You need to use binding on resource body with object
There just specify title: system.search.title
Thanks! Finally got it! I was trying to manually type this in the largest editor but I needed to get into the binding window where I could select the system vars.

It worked in is location.
Attachment
CleanShot_2024-11-02_at_09.16.322x.png
Add a reply
Sign up and join the conversation on Discord