user2572790
user2572790

Reputation: 476

Rails remove params from rendered form

i have a form in a page, with submit button. Form contains some inputs. When user press sumbit button, he gets so link:

/top?user_id=67508&country=&state=&city=&mode=0&page=19

How to remove empty params, user should not see it - country, city, state in this example

params.delete :country - don't works

Upvotes: 0

Views: 569

Answers (1)

nicohvi
nicohvi

Reputation: 2270

You cannot stop any parameters from being submitted from the client by using ruby code. This could easily be solved through Javascript by listening to the submit event of the form, and attaching a handler to this event which filters the parameters.

See this answer for an example.

Upvotes: 3

Related Questions