Home App Docs Blog Github

Submitting data to builder model when clicking the form submit button

Is there any way to submit the data of the form to the builder itself like data model or section model?

trying to make a review form
I’m trying to make a review form in builder which can able to store the data submit by the user to the builder data model or section model.

@anupama.sharmaa yes this is definitely possible using out Write API

within the JS to submit the form, just make sure to grab the relevant data and you can update directly in Builder. Check out or documentation and let us know if you have any further questions

1 Like

Firstly Thank you so much for your help It really help me a lot. but It gives me an CORS error while fetching, here is the screenshot of my error.

@anupama.sharmaa could you share the API request you are making? Do not include your private key, you can just replace with a place holder to not post on the forum.

There shouldn’t be any CORS requirements from the API, if you are adding anything I would remove anything from your headers except the Authorization with your private key.

1 Like
const postData = async (url, data) => {
 const response = await fetch(url, {
    body: JSON.stringify(data),
    headers: {
      Authorization: "Bearer privatekey",
      "Content-Type": "application/json"
    method: "POST"

  return response.json();

const name = event.target.elements.name.value;
const comment = event.target.elements.comment.value;
const rating = event.target.elements.rating.value;

// console.log('username: ', name + ' comment: ', comment + ' rating: ', rating  );

const dataObject = {
  name: name,
  data: {
    userName: name,
    comment: comment,
    rating: rating
postData('https://builder.io/api/v1/write/reviews', dataObject)
.then((data) => {
  console.log('data: ', data);
  if(data) {
    state.hidden = true;

@anupama.sharmaa apologies for delayed response, I seem to have missed this reply and only just now seeing it. That post method all looks correct, in fact I copied it directly into a demo space of mine and was able to get it working. Have you checked within your own app to make sure there are no CORS issues causing these to fail? From our end everything looks correct.