You can read and write those params by just treating them as new variables throughout the code.
Overview
Suppose we need to check the version of something an app is using and offering in a form, but I need that to then effect how something in the view renders.
So, I can set whatever variable I want in the conn_params, and then use that variable name in the form and setting its attributes being presented in the form (maybe it has various options, or in your case maybe a text_field) and then when the submit happens and the script runs it also may use that information to do some logic, which is typical.
But, the key is now when that view renders, it can use ERB to check the value of that form attribute we made up to then decide what to render and now we have the form and view interacting.
This problem
That’s abstract though. Let’s try a real example. So in the form let’s add a text field for the description.
I’d add an option in the form for a text field and call it something like r_session_description so you hae something like this:
---
...
attributes:
r_session_description:
label: "A text description of your R session"
widget: text_field
So now we have the field rendering in the form and the user can input text.
To then get this to pop in the view, we need to add this r_session_description to the conn_params in the submit.yml.erb and also export the variable from the before.sh.erb file so that the field is available in the view.
In the submit.yml.erb:
attributes:
r_session_description:
label: "Session Description"
widget: "text_field"
cacheable: false
Then, in the before.sh.erb add:
export r_session_description="<%= context.r_session_description %>"
Now alter the app’s view to include this text_field like so:
<% if ! r_session_description.blank? %>
<%= r_session_description %>
<% end %>
And wherever that is inserted in the view will have the description render that was entered in the text_field if it was used, else nothing displays.
Hopefully that is a rough enough example to get you further. Please let me know if you have any more questions!