How can I pass a boolean value in a form to a controller without the user being able to see or edit it? I’m assuming hidden_field is used for this, but how can I then assign a value to the variable?
Thanks for the help
-Pat
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Pat,
I am slightly confused by what you mean with the ‘but how can I then assign a value to the variable’, but I’ll give this a go.
First off, you are correct in the hidden_field bit.
or, alternatively
You get the point with that, I’m sure.
From there, in your controller, when the form is submitted you would get the value of that field like so:
Obviously variable names would be different, but that’s the general gist of it all.
Good luck!