I’m trying to add a “preview” button/page to my app.
Is there a way to add a different value to both my “post” and “preview” submit buttons that get passed in the params hash so that I can check which one was pressed in the controller and render the view accordingly?
Is this the best way to do this?
The keys of the
paramshash are just thenamevalue of an element.If you had two buttons named “submit”, one with
value="post"andvalue="preview", then you could do something like: