View Single Post
  #4 (permalink)  
Old June 12th, 2008, 05:37 PM
rgonnering rgonnering is offline
Registered User
 
Join Date: Jun 2008
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi all,

I was playing around with textfields2 (p. 137) and got it to work with the following input.rhtml:


<html>
  <head>
    <title>
     Using Text Fields (2)
    </title>
  </head>
  <body bgcolor="abcdef">
    <! Comment: Title>
    <h1>
     Using Text Fields (2) to read data from text fields.
    </h1>
    <br><br>
    <! Comment: Content>
    <% form_tag '/look/at' do -%>
      <div><%= submit_tag 'Save' %></div>
      Please enter your name,
      <br>
      <%= text_field_tag 'text1', "", :size => 30 %>
      <br><br>
      <input type="submit" />
    <% end -%>
  </body>

So post worked and replacing deprecated shortcuts worked. Hurray!

I then went back to text fields and using the same code for input.html worked. I then copied the source from the webpage and inserted it into input.html. It looks like this:

<html>
  <head>
    <title>
     Using Text Fields with Post
    </title>
  </head>

  <body bgcolor="ccddee">
    <! Comment: Title>
    <h1>
     Working with Text Fields using POST
    </h1>
    <br><br>
    <! Comment: Content>
    This Ruby on Rails application lets you read data from text fields using the POST method.
    <br>
    <form action="/look/at" method="post">
    <input name="authenticity_token" type="hidden" value="2f7c0cc1a11182f149e34c4f438f7eee94f0d6c7" />
      Please enter your name,
      <br>
      <input id="text1" name="text1" size="30" type="text" value="" />
      <br><br>
      <input type="submit" />
    </form>
  </body>
</html>

It does NOT work. ActionController::InvalidAuthenticityToken error

If you see something wrong, please let me know. Since shortcuts work, I don't really need this, but it might provide some insight.

Thanks.