SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: Sticky form

  1. #1
    SitePoint Member
    Join Date
    Jul 2007
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Sticky form

    I am trying to make a sticky form for a log-in first page. The idea is taht a user logs in, and then hits the submitt button. Now, there are checks that happen - password, email uniqueness, etc. If these checks fails, I would like to re-direct them back to the log-in page, but with all the non-vital info still present on the page. Since nothing has been written to the database yet, this is very difficult, for me at least. What I have been trying to do in this log-in page, 'traveler_form,' you enter your info then the action: 'create_user' is initiated. If the checks fail, the controller kicks you back to the 'traveler_form' page, but again, with the entered info still present just not submitted to the database. But nothing I try seems to want to make it stick. Anyone have any ideas? Thanks,

    ~TRS

  2. #2
    SitePoint Guru
    Join Date
    Aug 2005
    Posts
    986
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Don't redirect back to traveler_form in create_user: you'll lose the info the user entered. Just leave the model as-is and render the template of traveler_form in create_user (render :action => :traveler_form).

  3. #3
    SitePoint Member
    Join Date
    Jul 2007
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That worked. I had to say @user = User.new(params[:user]), which held all the parts of the user from the form, but the missing part was the render rather then the redirect_to. Thanks for your help,

    ~TRS


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •