SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Thread: solo param

  1. #1
    SitePoint Enthusiast
    Join Date
    May 2003
    Location
    boston
    Posts
    45
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    solo param

    Is it possible to have a param not associated with some data in my database, but still handle it in RoR?

    For example, in my view I have:
    Code:
    <%= text_field "","business_name", "size"=> 15 %>
    And in my controller I have:
    Code:
    business = CGI.escape(params[:business_name])
    But this doesn't capture business_name correctly. Is this possible?

  2. #2
    SitePoint Wizard silver trophy redemption's Avatar
    Join Date
    Sep 2001
    Location
    Singapore
    Posts
    5,269
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    In this case you're probably looking for the text_field_tag helper method.

    In your view:
    Code:
    <%= text_field_tag 'business_name', nil, :size => 15 %>

  3. #3
    SitePoint Enthusiast
    Join Date
    May 2003
    Location
    boston
    Posts
    45
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you so much Chu, exactly the pointer I needed! Worked perfect

  4. #4
    SitePoint Guru silver trophy Luke Redpath's Avatar
    Join Date
    Mar 2003
    Location
    London
    Posts
    794
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Also, I'm not sure you need CGI.escape - I'm almost certain Rails will do these for you automatically.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •