How to save data from the form created in ShowModal function to its respective tables on click of submit button

I am new to the community as well as R studio and shiny or one can even say new to coding.

I have created a form in ShowModal and now want to save the data that user enters into relevant tables in SQL on click of a submit tab. I dont know how to. Can someone please guide.

Hi, in example, in this example, the input is input$dataset. You could set up your application to write to a database or somewhere else. You could create the table first, then add the new values in to a new data frame that you could append to that table.

Shiny - Create a modal dialog UI — modalDialog (rstudio.com)

Something like this perhaps?

r - Shiny Inputs Append Data Frame - Stack Overflow

1 Like

Thank you William.
Some questions
Do I need to create data frame for each of the tables? As I have separate tables for separate things (for. eg. Vegetables table, fruits table & animals table). Do I need to create separate data.frames in one Observe event.
When I create my first data frame I get Input Error : input not found.

Hi, it depends on the format of your tables. If they are all different, then you might want to create four of them.

A reproducible example would be useful. The table should exist already though before you start the app, then you would just append the data provided to it.

1 Like