# How to access the contents of a field

**URL:** <https://www.ruby-forum.com/t/how-to-access-the-contents-of-a-field/195211>\
**Category:** Rails\
**Created:** [September 19, 2010, 10:18pm UTC](https://www.ruby-forum.com/t/how-to-access-the-contents-of-a-field/195211 "2010-09-19T22:18:57Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![abdelkarim](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/7feea3/32.png) [@abdelkarim](https://www.ruby-forum.com/u/abdelkarim)\
**Post date:** [September 19, 2010, 10:18pm UTC](https://www.ruby-forum.com/t/how-to-access-the-contents-of-a-field/195211/1 "2010-09-19T22:18:57Z")

</div>

hello every body i have a simple question .

i have this form :

\<%= form\_tag :action=\>‘password’ %\>

Password:\<%= password\_field 😛 , :pass1 , :size=\>‘20’%\>  
Again:\<%= password\_field 😛 , :pass2 , :size=\>‘20’%\>

how can i access the contents of the two field in ruby ?

by doing this : ch1=params[:p][:pass1] i have an error

You have a nil object when you didn’t expect it!  
You might have expected an instance of ActiveRecord::Base.  
The error occurred while evaluating nil.[]

thanks 🙂

---

<div class="post-metadata">

**Author:** ![abdelkarim](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/7feea3/32.png) [@abdelkarim](https://www.ruby-forum.com/u/abdelkarim)\
**Post date:** [September 20, 2010, 5:42am UTC](https://www.ruby-forum.com/t/how-to-access-the-contents-of-a-field/195211/2 "2010-09-20T05:42:32Z")

</div>

On 10-09-19 04:18 PM, abdelkarim wrote:

> how can i access the contents of the two field in ruby ?

give this a try:

\<%= form\_tag( :action =\> ‘search’ ) do %\>  
Password:\<%= password\_field\_tag :pass1, nil , :size=\>‘20’%\>  
  
Password:\<%= password\_field\_tag :pass2, nil , :size=\>‘20’%\>  
  
\<%= submit\_tag %\>  
\<% end %\>

then you can access the values from you controller, like this:

ch1 = params[:pass1]  
ch2 = params{:pass2]

–  
Kind Regards,  
Rajinder Y.

---

<div class="post-metadata">

**Author:** ![abdelkarim](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/7feea3/32.png) [@abdelkarim](https://www.ruby-forum.com/u/abdelkarim)\
**Post date:** [September 20, 2010, 7:12am UTC](https://www.ruby-forum.com/t/how-to-access-the-contents-of-a-field/195211/3 "2010-09-20T07:12:04Z")

</div>

dont forget to user ssl

---

<div class="post-metadata">

**Author:** ![abdelkarim](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/7feea3/32.png) [@abdelkarim](https://www.ruby-forum.com/u/abdelkarim)\
**Post date:** [September 20, 2010, 6:02am UTC](https://www.ruby-forum.com/t/how-to-access-the-contents-of-a-field/195211/4 "2010-09-20T06:02:25Z")

</div>

correction: sorry for the typo, you can access the values from your  
controller like this:

ch1 = params[:pass1]  
ch2 = params[:pass2]

–  
Kind Regards,  
Rajinder Y.

---

<div class="post-metadata">

**Author:** ![abdelkarim](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/7feea3/32.png) [@abdelkarim](https://www.ruby-forum.com/u/abdelkarim)\
**Post date:** [October 5, 2010, 10:15pm UTC](https://www.ruby-forum.com/t/how-to-access-the-contents-of-a-field/195211/5 "2010-10-05T22:15:24Z")

</div>

thanks all 🙂

but i dont have any idea about using ssl ☹

---

<div class="post-metadata">

**Author:** ![abdelkarim](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/7feea3/32.png) [@abdelkarim](https://www.ruby-forum.com/u/abdelkarim)\
**Post date:** [October 5, 2010, 10:45pm UTC](https://www.ruby-forum.com/t/how-to-access-the-contents-of-a-field/195211/6 "2010-10-05T22:45:51Z")

</div>

Whenever you have a page that sends confidential information back and  
forth  
you have to encrypt it, because when a user hits submit, the html goes  
back  
to the server in pure text and can be read by anyone along the way to  
the  
server. What is done is that PKI infrastructure is used to ensure no one  
in  
the network can intersect the data an read it.

Google SSL, TLS , PKI, Certificates, CA and encryption.

HINT: pages with ssl show a little lock in the status bar of the browser
