Displaying 20 results from an estimated 4000 matches similar to: "Model validation when using ajax & form_remote_tag..."
2006 Jul 21
0
Ajax page.replace_html model validation errors
I have the following setup:
A model: that validates using helpers like: validates_presence_of, etc..
A view: called ''new'' which renders a partial
The partial: _form which has error_messages_for and a
form_remote_tag , submit_tag and end_form_tag
An action ''create'': that gets executed via the submit_tag in the
_form and which
in case it can''t
2006 Jul 24
0
Ajax page.replace_html model validation render partial errors
Hi; I have the following setup:
A model: that validates using helpers like: validates_presence_of, etc..
A view: called ''new'' which renders a partial
The partial: _form which has error_messages_for and a
form_remote_tag , submit_tag and end_form_tag
An action ''create'': that gets executed via the submit_tag in the
_form and which
in case it can''t
2006 Feb 12
1
[newbie] Question about form_remote_tag
Howdy,
I have a form that is defined with "form_remote_tag(:update =>
"my_status", :url => { :action => :responder, :id => @event.id } )",
that uses a model with call to validates_presence_of.
The problem is, I can''t seem to figure out how to update the screen
after an @object.save fails, because of values missing (i.e.
validates_presence_of).
The
2007 Jul 15
0
errors_for
Been playing with merb.
One of the helpers I liked in rails was on form validations. Found
this was real easy to port over, so I thought I''d share.
It doesn''t highlight the field with the error, but it gives that same
nice little div on top.
Say I had an articles controller
def create
@article = Article.new(params[:article])
@article.save!
redirect
2006 Aug 18
0
AJAX question
Dear all,
Help me get a simple AJAX behavior right. I know zero AJAX, thus
please advice. Below is a simplification of the real code and I hope
I can describe my intention clearly.
class StoreController < ApplicationController
def show_cart
@cart = Cart.new
@new_item = CartItem.new
end
def add_item
@new_item = CartItem.new(params[:new_item])
if
2006 Aug 18
0
Simple AJAX question
Dear all,
Help me get a simple AJAX behavior right. I know zero AJAX, thus
please advice. Below is a simplification of the real code and I hope I
can describe my intention clearly.
class StoreController < ApplicationController
def show_cart
@cart = Cart.new
@new_item = CartItem.new
end
def add_item
@new_item = CartItem.new(params[:new_item])
if @new_item.valid?
2006 May 19
1
validates_presence_of and ajax-forms
Hi.
I have "validates_presence_of :login, :password, :firstname,
:lastname" in my user-model. I enter the information in
new_user.rhtml:
<%= error_messages_for(:user) %>
<%= form_remote_tag :url => { :action => :register }, :html => { :id
=> ''new_user'' } %>
I have a register.rjs with :fade.
Omitting firstname or any other required field
2006 Apr 04
3
Forms, view & AJAX best practice help
What i''m trying to get working is I have a controller called
"permissions" and a view "permissions.rhtml". This view has a hidden div
that contains a form for adding new roles. Its just a single textfield.
Also on the page I have a dropdown list of roles and then underneath
that a div that contains a list of permissions for the role selected in
the dropdown. I
2006 Apr 19
1
AJAX - update item forms problem
I have a table showing some records from the database. These records
should be always ordered by some datetime field. The list of items is
changed by AJAX using RJS scripts and edits are done by showing and
hiding an update form under a chosen row. Adding and updating rows works
great but my problem is when the order of items is changed after making
some AJAX datetime updates update forms of
2007 May 09
1
Custom validation error messages.
Hi all,
I have a few questions regarding the error messages which are produced
by default. For example, if I have "validates_uniqueness_of" I may get
an error message "Surname has already been taken''
What if I want a custom message without prefixing the attribute name?
I''ve come across a plugin which allows me to do this:
validates_uniqueness_of :name, :message
2006 Apr 23
3
Does AJAX form_remote_tag remove "\r\n"?
When I submit textarea with "\r\n" inside its content, all the "\r\n"
are gone at the receiving end? Is there a known behavior I should be
aware off? Or should I start looking some where else.
Thank you,
Sharkie
2006 Aug 29
1
Scope problem with form_remote_tag, ajax?
Hi all,
I have tracked an odd behavior down to what I think is an issue of
scope. In short, when I use form_remote_tag to establish an AJAX form,
my database fields don''t get populated when performing an edit on the
record. Those same fields will get populated using start_form_tag and
no AJAX. I think that Ruby can''t find the local object that represents
the database
2007 Sep 10
2
form_remote_tag not providing params in Ajax
I''m new to Ruby, Rails and Ajax and I''m trying to do something
seemingly simple. I am trying to use a value someone supplies in a
form in another form that is dynamically generated using Ajax.
I have the following code:
<div id="race_table">
</div>
<%= form_remote_tag(:update => "race_table", :url => { :action =>
2006 Jun 13
7
help with ''error_messages_for''
Greetings,
I''m in the throws of deploying an app on site5, and I''m getting strange
errors. I think I might need to understand how error_messages_for
works.
I get a pretty standard looking error:
"
You have a nil object when you didn''t expect it!
You might have expected an instance of ActiveRecord::Base.
The error occured while evaluating nil.errors
Extracted
2009 Feb 05
6
get # of errors in error_messages_for
hi everyone here i go again, i have problem we error message validation
here is the sample of my code:
error_messages_for :user, :header_message => ''X errors, please find red
mark'', :message => ''Following errors were found:''
the problem is that how where going to get the value "X errors" or the
number of errors if they have when the is
2009 Nov 26
9
ActionView::TemplateError (can't convert ActiveRecord::Error into String)
I cannot work out why this error is appearing.
ActionView::TemplateError (can''t convert ActiveRecord::Error into
String) on line #3 of app/views/button/_show_enquiry.html.erb:
1: <h1>Send us a message</h1>
2: <% remote_form_for :enquiry, :url => {:action => ''send_mail''} do |
f| %>
3: <%= error_messages_for ''enquiry'',
2006 Jul 05
1
Prototype Based Validation with form_remote_tag
Hello,
I am attempting to use validation.js from
http://tetlaw.id.au/view/blog/really-easy-field-validation-with-prototyp
e/ with form_remote_tag. The rails form helper binds the needed
Ajax.Updater to the onSubmit action of the form. The validation.js also
attempts to bind to the onSubmit of the form.
The logic that is needed is
if( valid.validate() )
{
...Ajax.Updater...
}
where valid
2006 Jun 27
0
More idiomatic way of doing this
Folks,
I''m trying to write a validating filter that checks if the user
exists and renders XML if not. Most of the controllers will be
returning XML on some error or other so I''m including RenderError in
ApplicationController.
Is my approach a sound one? Also, is there a shorter and more
idiomatic way of writing this:
if @user.nil?
render_user_exists
2009 Aug 16
4
How show validation errors in form_remote_tag?
I suspect this has been asked 400 times, but Google yields 2-3 rather
complex gymnastics in blogs (and possibly dated), and searching list
archives on ruby-forum proves kinda useless.
Using standard forms, it''s fairly easy to use
@object.errors[:field_name] in the form to embed an error message right
next to the field that has the invalid entry. The controller uses a
simple conditional
2006 Jul 20
7
How do you use :message with validation?
If I do validates_uniqueness_of :name, :message => "It''s not
uniqueeee!!!"
then how do I have it display that message when the check fails?
-Ben Lisbakken
--
Posted via http://www.ruby-forum.com/.