similar to: Validation error messages help please

Displaying 20 results from an estimated 40000 matches similar to: "Validation error messages help please"

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 Feb 23
1
Ajax, validation, flash messages & redirects...
Hi everyone, I''m working on an file upload page that uses an ajax progress bar (http://sean.treadway.info/demo/upload/). I''ve also got validation on the uploads (must be a certain file size/mime type etc). When uploads pass validation - all is dandy. But when they fail - I can''t work out how to redisplay the form with the flash error messages (that normally appear
2012 Jan 18
2
Polymorphic and standard association issue
Hello all, I''m having a strange issue with a model that belongs_to two other models. The one association is polymorphic and the other is normal. ================================ class Role < ActiveRecord::Base belongs_to :user belongs_to :permission, :polymorphic => true end class User < ActiveRecord::Base has_many :roles has_many :programs, :through => :roles end
2006 Mar 17
2
Validation not working.......
HI, I am new to ruby. I am developing small application in ROR. Following is code for my rHtml , Controller & Model. PLease see it & let me know why data in form is not get validated & also how to check for whether data i have entered in form (username) is present in database or not? (Like Login form). following is my code:- ---index.rhtml-------- <%= start_form_tag(:action
2006 Feb 08
1
Weird validation issue
Hi, I''m having a weird validation issue. Validation isn''t working for certain attributes and, for some reason, it''s also affecting things outside of validation. For campers on certain camp types, we require some information about their school. I tried to validate the information this way: validates_presence_of :school_type, :if => Proc.new { |c| !c.booking.nil?
2008 Jul 08
1
Problems with form_remote_tag
Hi, I am trying to use form_remote_tag to update a record and then update the section of the page where id=''opertion_panel''. There is a javascript validation that validates the input before the record is being updated. This validation works and the record was successfully updated. The problem is after the record is being updated, it didn''t update operation_panel.
2006 Feb 16
1
Help with validation
I am trying to write some simple code post a form, update the database and do some validation. I have 2 problems: 1) The validation fails but I can''t get hold of the error message 2) I can''t get the form to redisplay the previously entered data for the user to correct. I have 2 controllers: user and holiday. A user can request a new holiday by filling in a form. I have a
2010 Feb 16
0
Strange routing(?) Issue
I have a Model event and the following two lines in routes.rb 1 - map.connect "events/:action", :controller => ''events'', :action => / [a-z_]+/i 2 - map.resources :events, :has_many => :comments, :has_one => :address #, :collection => {:mapit => :get} I have #1 so that I can call custom actions from a link_to_remote link from my index page t0 update a
2006 Jul 02
3
2 before_filters, only want one to render something
I have two before_filters for a few of my controllers. They are running my own methods authorize and admin_authorize. authorize is called on just about every action to make sure that a user is logged in. admin_authorize is called on about 80% of the actions and is used to make sure that a user is an administrator. If a user tries to access an admin_authorize protected action without being
2006 Jul 19
5
Model Validation - with a twist
I''m stuck in a catch-22 type problem. I have an insert form for a table that uses the validation in the model. i.e. When you click submit on the form and haven''t filled in the required fields then you get the nice rails error messages saying "field can not be blank". This works fine until I introduce some more logic. What I''m trying to do is to validate
2009 Mar 15
1
remote_form_for ajax validation
Hi, I have been reading a lot about this, but I do not manage to do a nice validation. I already managed to save data to the database, to validate a field, to display a "Everything went well" message. I can also display an error message, but the view does not end up properly. This is the form: <% remote_form_for(product) do |f| %> <%= f.error_messages %> <p>
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
2006 Aug 16
3
Validate your forms with a table-less model
Ive followed this example of how to validate a form with a tableless model: http://rails.techno-weenie.net/tip/2005/11/19/validate_your_forms_with_a_table_less_model Ive got this example working but when validation fails the failed boxes are not highlighted in red. At the moment i have a contact details form and want to validate the information entered by the user but this will just result
2006 Mar 07
2
redirect after validation
I have a difficulty with something that makes me think I don''t understand an aspect of Rails what. I''ve made a sort of blog site, and under each article I show the comments and a comment form. The comment model validates whether the user has entered his name. When he hasn''t, I want to send him back to the form with his comment text still there. In the comment/create
2006 Aug 07
0
Capturing Validation Errors from Nested Model Creation..
Hello Everyone, The subject sort of says it all ;) but, I will explain. Currently I have an object (Booking) which, when its created, will also have new contacts created everytime with it (for arguements sake). So, I can wrap these both in a transaction, however, if any one of the contacts fails the validation of the contact model, it will fling up a validation error. So, what is the
2007 Jul 24
6
Mocking Access Control
I''m trying to jump on the TDD/BDD bandwagon, but am having trouble understanding how i should mock my user. The user has a habtm relationship to a roles model (acl_system2 plugin), but I''m not sure how to tell rspec about a model. My code: describe UsersController do integrate_views before(:each) do @user = mock_model(User)
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 Apr 22
3
Creating a select dropdown box with links to methods
What would be the best way to create a form select dropdown box and upon "submit" have it directly go to a controller method view? I have something that somewhat works, but I think there is probably a much easier way to do it. As of now, I have the dropdown list which when the form is submitted is handed to a controller method which basically I have my dropdown box: <%=
2006 Feb 08
2
Protecting controllers - looking for a DRY solution
Hello everyone, I''ve got several different user roles (i.e. admin, user, guest, ...) and have set up a bunch of controllers for each user role. I''m trying to set up some sort of validation that the user accessing e.g. the admin/subjects controller has the ''admin'' role. The brute force way to do this would be something like: - for each controller, put in
2006 Jul 07
4
need help with some ugly code - is there a better way?
Hi, In my user_controller.rb, I have the following method, which is supposed to send the user to their profile, dependng on what "role" they are (the roles correspond to the other controllers: venue, band, fan): def login if request.post? if session[:user_id] = User.authenticate(params[:user][:login], params[:user][:password]) flash[:message] =