Issuing POST from within a shiny app

I don't think I fully get the question still.

Current understanding:

  • Goal: Hide parameters from user
  • Need: Send parameters to external server

Then display the returned value? Then ignore the returned value? ("Open" is a vague term)

(In my past life, the results are not displayed when POSTing a form.)

Note:
With any of the solutions here, the user would be able to sniff out information if they really wanted it.


Assuming you do not want the result.

I would send the parameters back to the shiny server and have the shiny server (not the browser) do a httr::POST request to the cgi script.


Assuming you do want the result.

I would send the parameters back to the shiny server and have the shiny server (not the browser) do a httr::POST request to the cgi script. The result of this can be set to a reactive value to be displayed using uiOutput / renderUI. (If the script returns raw HTML, remember to use htmltools::HTML(txt))

This allows you to have full control over what is presented to the user and it will look / act as if the script output is native to the shiny application.


However when I try and embed this same form in a shiny script it does not work in the following ways:

  1. The form submit button does not work
  2. I cannot get a handle to the form using document.GetElementById() javascript
  3. All HTML after the form does not display correctly on the page.

This makes me want to believe that the form was malformed and the browser could not interpret it properly. There should be no reason why any of these situations are not working.


If I have still missed the problem, can you post a small reprex showing off the error? See Shiny debugging and reprex guide