Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 780407
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T20:04:03+00:00 2026-05-14T20:04:03+00:00

This is quite difficult to explain, but here goes. I have a Rails app

  • 0

This is quite difficult to explain, but here goes. I have a Rails app with students, courses, assignments and grades

In the student show view, there is a list of all of the courses that a student takes, along with the assignments associated with those courses. All assignments which there is a recorded grade for between the student and the assignment also state the grade, all others display ‘N/A’. What I would like to do is have a link to a form with the student and the assignment field pre-populated, depending on the link that was clicked.

Here is an example. Peter Parker has a grade for the ‘mathematics exam’, but not for the ‘mathematics CW’. If the user clicks the ‘Add’ link, I would like a view to be displayed with a form pre-populated with the student name and assignment name, ready for the grade to be added.

alt text http://img695.imageshack.us/img695/7540/screenshot20100512at180.png

I essentially don’t know how best to pass this data to the form, or how to have the form display the data in an uneditable way.

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T20:04:04+00:00Added an answer on May 14, 2026 at 8:04 pm

    Jack you have a few questions here, one of them is relatively easy to display the data in an uneditable way you can make it disabled

    http://www.w3.org/TR/html401/interact/forms.html#h-17.12

    How do I pass the student_id and assignment_id to the form? the system is only going to be used locally, but I will validate everything none the less. – Jack

    Jack, you will need something in your current view that can pass the student_id and assignment_id. like a link_to.

    <%= link_to "show me my assignments", {:action => 'show', :controller => "assignments"}, :student_id => student.id, :assignment_id => student.assignment[0].id %>
    

    (note it is probably better to use restful routes, but this shows better what is going on)

    what this link to will do is call the show action of the assignments controller. you can get the id’s in the controller by calling:

    assignment_id = params[:assignment_id]
    student_id = params[:student_id]
    @student = Student.find(:first, :conditions {:id => student_id})
    ...
    

    Then in your show.html.erb under /app/views/assignments/ directory you would need to render your form code, something like:

    <%= form_for @student, :student ...
    

    There are many many possibilities that I glossed over, the question you’re asking is a little bit broad. It may be more helpful to break it into smaller chunks (focus less on the application and more on one single action) and re-ask to the forum members.

    You could ask more about:

    • Sending data to a controller from a
      link
    • Finding items in your database from
      the controller
    • Generating a form from the instance
      variables in the controller
    • finally disabling text_field in a
      form

    I would say give what i’ve suggested a shot (send data from the view to a controller, and then use that data from the controller to render another view), and if you cannot figure out something, try to ask a very focused question about the problem you’re having, and you will likely end up with a much better over all product.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is quite difficult to explain so I have attached an excel file here:
Apologies for the vague title, but this is quite a difficult problem to explain
I have this quite popular problem, but have failed to find a solution that
This is quite difficult to phrase, but I need to be able to link
This is very specific, and a bit difficult to explain, and quite likely impossible,
this will be quite difficult to explain. I hope I'm able to. I recently
This is a little difficult to explain so please bear with me. I have
I've been looking for the answer to this question but it seems quite difficult
Please bear with me on this, this is quite difficult to explain and I
It is very difficult for me to explain this particular problem/question so please bear

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.