The extension is here:
http://github.com/zapnap/database_form/tree/master
The page I am trying to use it on:
http://texashope.andadv.com/prayer
Thanks,
Nate
_______________________________________________
Radiant mailing list
Post: Rad...@radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
Site: http://lists.radiantcms.org/mailman/listinfo/radiant
Man, I feel like suck a goon. That did the trick.
~Nate
Have you ever had to deal with the "wrong number of arguments (1 for 2)"
error? I finally got the form built and pages all set up, tried out the
form and BANG, I have that stupid error. It's why gave up on the
extension the last time I tried to use it.
If you have ever seen this and know how to fix it, please let me know.
Thanks,
This is where things are going wrong in the extension (lines 22-26) of
the extension:
~~~~
if save_form and redirect_to
response.redirect(redirect_to)
else
super(request, response)
end
~~~~
This is the fix that Charlie Robbins suggested
(link:
http://groups.google.com/group/radiantcms-dev/browse_thread/thread/783c07a89beafcf5):
~~~~
#Trim the leading / off the slug
redirect_to = redirect_to.gsub(/^\//, '')
@response.body = redirect_to
@response.body = Page.find(:first, :conditions => ["slug = ?",
redirect_to]).render
~~~~
Now cannot really make heads or tails of this. Can anybody explain what
is happening here? The author of the extension wrote in the ReadMe that
the extension worked with Radiant 0.6.4. Could there be something in
Radiant that changed to break this extension or was it not properly
written to begin with? Not trying to step on any toes, but it seems like
this extension would be more sought after and it would be nice to see it
working properly.
When I substitute the "fixed" code from Charlie, I get this error:
You have a nil object when you didn't expect it!
The error occurred while evaluating nil.render
Any insight would be appreciated.
Thanks,
This:
...
if save_form and redirect_to
response.redirect(redirect_to)
else
super(request, response)
end
...
Becomes this:
...
if save_form and redirect_to
response.redirect(redirect_to, "302")
else
super(request, response)
end
...
In tracking down this problem I found that Joel Williams had forked the
database_form extension and he had solved the problem I was running
into. As his fork includes some other added functionality, I have
switched to it instead of the original extension from Zapnap (Nick
Plante).
Back to your regularly scheduled program...
~Nate
This is my process function:
def process(request, response)
@request, @response = request, response
@form_name, @form_error = nil, nil
if request.post?
@form_data = request.parameters[:content].to_hash
# Remove certain fields from hash
form_data.delete("Submit")
form_data.delete("Ignore")
form_data.delete_if { |key, value| key.match(/_verify$/) }
@form_name = request.parameters[:form_name]
redirect_to = request.parameters[:redirect_to]
if save_form and redirect_to
response.redirect(redirect_to, "302")
else
super(request, response)
end
else
super(request, response)
end
end
Seems to work fine.
http://github.com/joelw/database_form/commits/master
zapnap should merge that fix into his plugin, or the radiant extension
page should link to the working plugin.
Joe
Use this plugin instead: http://github.com/joelw/database_form/commits/master
And someone should update the radiant site to point at that plugin
instead, zapnap's is broken on recent radiant/rails.
Joe