Hello,
I am trying to integrate a captcha into a form that is used to update a
database. I am using a method that is outlined here:
http://svn.2750flesk.com/validates_captcha/trunk/README, but things are not
working correctly. The captcha image shows up in the user form, but the
captcha input is being ignored. The following shows my controller file:
class PublicController < ApplicationController
include ActionView::Helpers::TextHelper
verify :method => :post, :only => [ :destroy, :create, :update ],
:redirect_to => { :action => :index }
def index
@posts = Post.public_posts
end
def save
@supermodel = MySuperModel.find(params[:id])
@supermodel.attributes = params[:my_super_model]
@supermodel.save
end
def create
@post = Post.new(params[:post])
if @post.save
flash[:notice] = ''Post was successfully created.''
redirect_to :action => ''index''
else
render :action => ''new''
end
end
def new
@post = Post.new
end
end
The plugin is in my vendor/plugins directory as well. Here is my view:
<%= start_form_tag(:action => "create") %>
<table>
<tr>
<td>Title:</td>
<td><%= text_field("post", "title",
"size" => 46 ) %></td>
</tr>
<tr>
<td>Description:</td>
<td><%= text_area("post", "description",
"cols" => 40, "rows" => 10 )
%></td>
</tr>
<tr>
<td>
<% c = prepare_captcha -%>
<%= captcha_hidden_field c, ''my_super_model'' %>
<%= captcha_image_tag c %>
</td>
</tr>
<tr>
<td>
<%= captcha_label ''my_super_model'',
''Confirm Captcha <br />'' %>
<%= captcha_text_field ''my_super_model'' %>
</td>
</tr>
<tr>
<td></td>
<td><%= submit_tag(" Submit ") %></td>
</tr>
</table>
<%= end_form_tag %>
Can anyone tell me what I am missing? I think that it is more that a form
issue, since I am not getting errors about "wrong captcha" or anything
like
that.
Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://wrath.rubyonrails.org/pipermail/rails/attachments/20060716/ade0b149/attachment.html