Displaying 20 results from an estimated 40000 matches similar to: "error message on the redirected page"
2006 Feb 21
2
validations and directing errors
I am starting to play with validations as I want to catch errors before
SQL rejects inserts to the table which are ugly when nulls are sent to
''Not Null'' columns, etc.
If I do something in my model like...
validates_format_of :first_name,
:with => /^\w+$/,
:message => "you moron, enter a name"
I still end up
2006 Jul 17
2
error_messages_for ?
Hi,
I can''t list error_messages in my Form ??, and all the formfields are
reset ...(I think my redirect :back clean everything, formfield and
error_messages ...), only my flash[:notice] is ok....
I would like to use the "error_messages_for" tag to add a simple red *
on my textfiled if a problem occurs ...
thanks for help
arnaud
here are the basics steps to check that
2006 Feb 15
6
error_messages_for trouble
I am trying so learn how to do custom validations.
The validation works as expected, but I can''t get "error_messages_for"
to display.
How is the name of the object supposed to be formated?
Where is this object created, the model or controller?
What am I doing wrong here?
#### Model ########################
class MyFolder < ActiveRecord::Base
def validate
# validation
2008 Feb 27
8
ActiveRecord validation messages not I18N-friendly and enforces grammar
ActiveRecord validation messages are currently not I18N-friendly.
Specifically, I''m referring to the fact that it enforces a certain
grammar, namely the beginning of the message must consist of the field
name. For example:
validates_presence_of :name, :message => "can''t be blank."
...generates the message "Name can''t be blank". This grammar
2005 Dec 31
2
Validation errors not displaying and will not save
Hello all,
I''m fairly new to rails so I''m probably doing something really stupid
here.... I have been banging my head at this for hrs now... I''ve tried
so many different things and nothing seems to get me any further...
I am trying to create an image uploading page that will simultaneously
create thumbnails to separate file directories and update the database
via
2005 Jul 23
11
Validation without ActiveRecord
Hello, I followed the instructions at
http://wiki.rubyonrails.com/rails/show/HowToUseValidationsWithoutExtendingActiveRecord
But now I''m having trouble trying to create my form view. Here''s a
brief rundown of what I''ve done:
- Created a class called SearchRequest that extends ValidatingBase and
saved it in a file called search_request.rb and put it in my models
2005 Dec 16
12
validates_presence_of not working
Hi,
I''m new to ruby and rails. I just created a simple update page and the
update works fine if all form fields are filled in. However there is one
field that should never be allowed to be blank. So I put this in my
model:
class Topic < ActiveRecord::Base
validates_presence_of :dr_title
validates_length_of :dr_title, :minimum => 1
So, when I submit the form with a blank
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/.
2009 Apr 02
3
error_messages_for does not display the error
Hi all
I''ve approached Rails since a couple of months to develop a quick
application for my company. Fantastic framework. As every noob, I do
have some gaps to cover. The one which is giving me a little
frustration, generated by my lack of knowledge is as follows.
I need to make sure the region object is not deleted if there are
countries associated with it. I solved this by putting a
2008 Aug 31
9
assigning collection values and exceptions
hi everyone,
I''ve this code in my Report model:
has_many :report_reasons, :validate => true
has_many :reasons, :through => :report_reasons #, :uniq => true
# :accessible => true
def reason_attributes=(reason_attributes)
reasons.clear
reason_attributes.uniq.each do |reason|
reasons << Reason.find_or_create_by_content(reason)
end
end
2006 Aug 01
3
Validation on ActiveRecord destruction
Rails has many built in validation methods to ensure that an
ActiveRecord instance cannot be created or updated under certain
situations (typically caused by invalid data). However, I can find no
methods to govern whether an ActiveRecord instance can be destroyed.
Essentially, I wish an error to be raised when a user tries to delete an
ActiveRecord without first adhering to a certain set of
2006 Mar 29
2
save related models from one form
I have three tables customers, indentities and people. I hav ecreated
models for them. The are connected with foreign keys and
has_many/belongs_to in this fashion:
customers has_many: identities
identities belongs_to: customer
identities has_many: people
people belongs_to: identities
Now, I have a form in which I would like to create db entries for the
three tables. customers have a password
2006 Jan 09
4
How to carry parameters to a new page?
Hello,
I have a page where user can register him/herself to the site.
If the user enters something wrong, or leaves blank textboxes, I want to
reload the page and tell the user what went wrong. Also the
textbox-values the user already entered, should be kept in the
textboxes.
For example, in my user-controller:
if @username.length == 0
redirect_to :action =>
2008 Jun 02
5
validate - message in the flash[:error]
Hi,
I want to show the validate - message in the flash[:error] - field but I
can''t find any options.
An example:
class UserPermission < ActiveRecord::Base
validates_presence_of :name,
:message => "Please insert a name"
... |
end V
flash[:error] = "Error - "
Has anybody a solution for this
2006 Aug 07
1
Override flash message - help
How can I modify the flash message that is displayed on a validates_*
check? I used the :message => "" parameter, but it still gives me an
annoying "Test : Please ensure you have entered the test message". I
wanted to get rid of the "Test: " and the above "6 errors prohibited
this table from being saved" I looked at the source of
2008 May 20
3
Flash message not shown after redirected by verify
I have the following snippet in a controller.
verify :params => "post", :only => [:create, :update, :destroy],
:add_flash => {"notice" => "Invalid Access"}, :redirect_to => {:action
=> ''list''}
If I directly access /posts/create by typing URL (GET), the program
redirects to the "list" action, but the flash message I
2006 Mar 20
5
Wrap error_messages_for() call when no instance var present
I am trying to put some smarts around a call to
<%= error_messages_for %>
so that when I first come into this page i.e. when my instance variable
@target_list has not been defined yet, the page doesn''t break.
I''m doing this:
<% if @target_list? %>
<%= error_messages_for ''target_list'' %>
<% end %>
I get a syntax error on line 1.
2007 Jul 24
2
Nested params and redirect_to
I have a simple client search screen that posts the following params:
Parameters: {"search"=>"Search", "action"=>"list",
"client_search"=>{"first_name"=>"jane", last_name"=>"smith"},
"controller"=>"client"}
This works fine. However I want to redirect to the same
2009 Oct 06
1
Problems Processing multiple form elements generated by javascript actions
Hi all,
After many days of struggling, I have a multi-model form with ajax
elements more or less working, but I''m hitting a wall with a few bugs
that I can''t figure out. Guidance would be very much appreciated.
I''m using the Ryan Bates technique from Advanced Rails recipes to
dynamically add and remove elements on a multi-model form.
2005 Aug 07
8
Ajax forms and redirects
Here is an example that seems perfect for Ajax that I have not seen
implemented nor can figure out how to do it. I am hoping someone can
give me some pointers.
On the sign-up page, I would like to do my validations (password
length, username uniqueness,etc ) Ajax-style. But if all validates,
then redirect to the success page. The combining of redirection to a
new page with Ajax is throwing me.