How do I get back the users latest form submission?

Options

So I have a submission form and I want what you type in to be displayed right under the form right after you submit. How do I get the user's latest submission to be displayed right under? Also, how do I make it so when you have submitted once on that one page, you can't submit again?

Answers

  • pete letkeman
    Options

    When you submit the data to Xano, Xano returns the full record by default.

    Your client e.g. WeWeb can then be used to display the data. In WeWeb try the 'Return Data' and look for it under the lightning bolt icon.

    Regarding the can't submit again:

    • if you are requiring a user account then one form submission update a database value for that user account which controls if the submit button is shown/available.
    • if you are worried about people double-clicking then in your client e.g. WeWeb as soon as the first click occurs set a boolean value to toggle if the form has been submitted previously
    • if no user account then you can set a boolean value in local storage or in a cookie after they submit the form and in the form submission logic you check for this value. The end user can quickly get around this if they clear cookies/local storage.
  • sbjorklind
    Options

    Is it the /reviews/{reviews_id} or the /reviews?

  • pete letkeman
    Options

    Can you provide more context and/or information, such as what are you using for the front-end?

    I'm not too sure what your last question is asking.

  • sbjorklind
    Options

    Okay, so as displayed under I want you to be able to write a review and then for it to be displayed right under. I'm using bravo studio as my front end.

    This is how my "add review" endpoint looks like:

    And this is how my "get review" endpoint looks like:

    I don't know if I'm doing something wrong in xano or if it's the frontend that is the problem.

    Thank you for helping!

  • pete letkeman
    Options

    Okay, I think that you have to do something with the Response Actions as shown in the following image.

    By default, Xano returns the full record as a JSON object after a successful update/edit including the id/review_id. In Bravo there should be a way to consume this data for future use.

    I'm not entirely sure what your options are when it comes to this.

  • sbjorklind
    Options

    Are you sure I don't have to link the user and review in some kind of way? So that the right review gets pulled to the right user and page.