# Forms and controller scope

**URL:** <https://www.ruby-forum.com/t/forms-and-controller-scope/158435>\
**Category:** Rails\
**Created:** [January 23, 2009, 10:04am UTC](https://www.ruby-forum.com/t/forms-and-controller-scope/158435 "2009-01-23T10:04:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![scudco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/aca169/32.png) [@scudco](https://www.ruby-forum.com/u/scudco)\
**Post date:** [January 23, 2009, 10:04am UTC](https://www.ruby-forum.com/t/forms-and-controller-scope/158435/1 "2009-01-23T10:04:36Z")

</div>

Is it possible to pass predefined arguments along with a form with  
form\_for? i.e. an id etc?

I have a task model with usual title, completed(bool), duedate and a  
foreign key field called project\_id (a project has many tasks). On one  
view i want to have an “express add task” form i.e. there is only one  
field to fill in for the title. The rest of the attributes I want to set  
to some default values. The problem is this form will be sent to a  
dffierent controller.

As the user only submits a title ill also need the project\_id which is  
known is available in the view…is there anyway i can pass this along  
with the form?

---

<div class="post-metadata">

**Author:** ![scudco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/aca169/32.png) [@scudco](https://www.ruby-forum.com/u/scudco)\
**Post date:** [January 23, 2009, 10:39am UTC](https://www.ruby-forum.com/t/forms-and-controller-scope/158435/2 "2009-01-23T10:39:49Z")

</div>

Adam A. wrote:

> As the user only submits a title ill also need the project\_id which is  
> known is available in the view…is there anyway i can pass this along  
> with the form?

You can put some fixed parameters in the path part of the form’s  
action URL, which will be extracted by the Rails routes you define,  
plus put some more parameters in hidden form fields.

–  
Rails Wheels - Find Plugins, List & Sell Plugins -  
[http://railswheels.com](http://railswheels.com)

---

<div class="post-metadata">

**Author:** ![scudco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/aca169/32.png) [@scudco](https://www.ruby-forum.com/u/scudco)\
**Post date:** [January 23, 2009, 11:59am UTC](https://www.ruby-forum.com/t/forms-and-controller-scope/158435/3 "2009-01-23T11:59:07Z")

</div>

thanks very much for that. I went away and researched teh api more about  
hidden fields. I did try them out a while back but got an error and  
thought i was heading down the wrong path but you confirmed i was indeed  
looking in the right area.

thank you once again
