# Validation page problems

**URL:** <https://www.ruby-forum.com/t/validation-page-problems/176409>\
**Category:** Rails\
**Created:** [September 30, 2009, 8:07am UTC](https://www.ruby-forum.com/t/validation-page-problems/176409 "2009-09-30T08:07:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![thriving](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ecae2f/32.png) [@thriving](https://www.ruby-forum.com/u/thriving)\
**Post date:** [September 30, 2009, 8:07am UTC](https://www.ruby-forum.com/t/validation-page-problems/176409/1 "2009-09-30T08:07:38Z")

</div>

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](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

---

<div class="post-metadata">

**Author:** ![thriving](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ecae2f/32.png) [@thriving](https://www.ruby-forum.com/u/thriving)\
**Post date:** [September 30, 2009, 10:57am UTC](https://www.ruby-forum.com/t/validation-page-problems/176409/2 "2009-09-30T10:57:51Z")

</div>

> 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 🙂

Samiron paul

> **[Small Talk](https://samironpaul.blogspot.com/)**

> **[亚搏APP手机版-官方网站](http://www.scrumpad.com)**
>
> 亚搏app手机版下载是亚洲最具规模且成长最快的在线娱乐之一,当前国内最知名的游戏娱乐平台,汇聚了最新最热最好玩百款精彩游戏,国内最具影响力娱乐平台!

---

<div class="post-metadata">

**Author:** ![thriving](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ecae2f/32.png) [@thriving](https://www.ruby-forum.com/u/thriving)\
**Post date:** [September 30, 2009, 12:54pm UTC](https://www.ruby-forum.com/t/validation-page-problems/176409/3 "2009-09-30T12:54:42Z")

</div>

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](http://localhost:3000/users/1/edit)

It will become [http://localhost:3000/users](http://localhost:3000/users)

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

Samiron Rony wrote:

> > 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 🙂
> 
> Samiron paul  
> [http://samironpaul.blogspot.com](http://samironpaul.blogspot.com)  
> [http://www.scrumpad.com](http://www.scrumpad.com)
