# Searching with char like #

**URL:** <https://www.ruby-forum.com/t/searching-with-char-like/141329>\
**Category:** Deployment\
**Created:** [June 24, 2008, 6:42pm UTC](https://www.ruby-forum.com/t/searching-with-char-like/141329 "2008-06-24T18:42:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![eagoweb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/9de0a6/32.png) [@eagoweb](https://www.ruby-forum.com/u/eagoweb)\
**Post date:** [June 24, 2008, 6:42pm UTC](https://www.ruby-forum.com/t/searching-with-char-like/141329/1 "2008-06-24T18:42:32Z")

</div>

Hello i got a field to search a name in the DB

The problem is that the name could have char like #

so in my view:

\<%= text\_field\_with\_auto\_complete :member, :name%\>  
\<%= observe\_field ‘member\_name’,  
:frequency =\> 0.5,  
:update =\> ‘member\_named’,  
:url =\>  
{:controller=\>“admin/members”,:action=\>‘live\_search’},  
:with=\> ‘member\_name’%\>  
so if i put on the textfield “peter #2”  
i got \<%=params[member\_name]%\> peter

so everything after ‘#’ isn’t there, what could i do?

but in the auto\_complete all the names appear while i am writing…

---

<div class="post-metadata">

**Author:** ![eagoweb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/9de0a6/32.png) [@eagoweb](https://www.ruby-forum.com/u/eagoweb)\
**Post date:** [June 26, 2008, 6:05am UTC](https://www.ruby-forum.com/t/searching-with-char-like/141329/2 "2008-06-26T06:05:55Z")

</div>

You need to escape the input before you send it to your controller  
action.

You can use encodeURIComponent for this.

Good luck!

Robby

On Tue, Jun 24, 2008 at 9:42 AM, Edgar G.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> ```
> :update => 'member_named',
> 
> ```
> 
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).
> 
> >

–  
Robby R.  
Chief Evangelist, Partner

PLANET ARGON, LLC  
design // development // hosting

> **[Planet Argon](https://www.planetargon.com/)**
>
> Planet Argon is a Ruby on Rails development agency specializing in maintenance and support for existing Rails apps. Based in Portland, OR, Planet Argon has been a member of the Rails community since 2004.

[http://www.robbyonrails.com/](http://www.robbyonrails.com/)  
aim: planetargon

+1 503 445 2457  
+1 877 55 ARGON [toll free]  
+1 815 642 4068 [fax]
