Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

Rails 3: Why the field with error is not wrapped with "field_with_errors" div when validation fails? -


my product class has price field, has appropriate column in products table in database, , new_shop helper field (which defined attr_accessor, , not has appropriate column in products table in database).

when validation on price fails, input field wrapped field_with_errors div, when validation on new_shop fails, not wrapped field_with_errors div. why ?

here generated html these input fields:

<input type="text" name="product[price]" id="product_price"> <input type="text" value="" name="product[new_shop]" id="product_new_shop"> 

some more info:

class product < activerecord::base   attr_accessor :new_shop    accepts_nested_attributes_for :shop   validates_presence_of :price   ... end  class shop < activerecord::base   validates_presence_of :name   ... end 

when form submitted, new_shop value passed product's shop_attributes[:name].

so it's :name attribute fails validation? why new_shop doesn't fieldwitherrors div then: looks @ @product.errors decide on field field basis whether has errors. ie

#comes :new_shop field #looks see if @product.errors.on(:new_shop) not blank #if isn't blank, wraps error div round it.  

Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -