Values in form fields lost after validation

Can you post your controller code? It looks like the @contact_detail object isn't being populated. It's probably something to do with the order that you're assigning and validating things.


Yu Co wrote:

the relevant code piece of the corresponding controller looks like this:

def create   @contact_detail =[:contact_detail])   @customer =[:customer])   @customer.contact_detail = @contact_detail

  if      session['user'] = @customer      session[:customer] = nil      else

     begin        session[:errors] = @errors      end end

I can't see how you're redisplaying the form. Are you doing a render(:action => :new)? Are you redirecting back to the 'new' action using redirect_to(:action => :new)? Or do you have a separate create.rhtml template?


Yu Co wrote:

and the controller auth looks like this:

  def register     @customer = session[:customer] == nil ? : session[:customer]     @errors = session[:errors]   end

I checked the values within 'register' action. And indeed the entered data in the form is available under @customer.contact_detail. But after submitting the form the contact_detail dates are not shown but the customer dates.

Your view is expecting to find the contact_detail object in @contact_detail, but you're not setting this in the controller code.

Try adding:

@contact_detail = @customer.contact_detail

to your register action.