Validation page problems

I have made form for create user page and edit user page

in create user page there is no password and password confirmation
text_field
as the password will be sent through email.

but in edit page there will be password and password confirmation field.
i do something like

      -if params[:action]=="edit"
        .field
          = f.label :password
          %br
          = f.password_field :password
        .field
          = f.label :password_confirmation
          %br
          = f.password_field :password_confirmation
        .clear

but when other field is invalid and it redirect to invalid page, the url
become something like

http://localhost:3000/users/1

then the password and password confirmation field disappeared

i have tried something like puts @password_filed = true and put it is
edit action of user controller instead of usinf params[:action] but it
still not work.

anyone have any suggestion for me please

but when other field is invalid and it redirect to invalid page, the url
become something like

Did you mean when you are updating the user information and any of
required fields other than passwords missing then redirecting to
invalid page??
Could you please provide your update action so that i can understand
what you are doing in case in invalid situation?

However i guess if you really encounters any invalid form submission
then you should render edit action again. Most likely you have
validation in your User model and using "error_message_on" in view
will show the invalid fields with error messages.

Hope this will help you :slight_smile:

Samiron paul
http://samironpaul.blogspot.com
http://www.scrumpad.com

I'm sorry to make it ambiguity. invalid page in my meaning is the page
provide the information about what are invalid like

There were problems with the following fields:

    * Username is too short (minimum is 3 characters)
    * Username should use only letters, numbers, spaces, and .-_@
please.
    * Username should be in email format

So instead of url http://localhost:3000/users/1/edit

It will become http://localhost:3000/users

is there any condition to check that which action it is before come to
error page ?

Samiron Rony wrote: