Pass variable from html text field to a Rails function

In my Rails project, in a show view, I need to have a html text field where to enter a value.
Next to the text field I need to put a button, this button when pressed has to call a funtion that uses this variable as a parameter.
This funtion is responsable to add a new record in a remote DNS database.
Can you please tell if it is posiible to do this in Rails 6?
Thank you!

Are you looking to do this in an AJAX call? I’m guessing when the button is pressed, you want to pass some parameters in an AJAX call to the server — is that right?

Or do you mean simply submitting a form the standard POST way?

I searched a bit and in the end I have found that it can be done, what it was requested, with Bootstrap modals which is using Javascript.
I struggled a bit but in the end it is functional :slight_smile: . I need to read more and learn Ajax or Javascript.
Thanks!

I definitely feel you on that. I’m going down the Hotwire Turbo and Stimulus rabbit hole and migrating lots of old jQuery modals myself.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs