# How to add default value to text\_field\_with\_auto\_complete

**URL:** <https://www.ruby-forum.com/t/how-to-add-default-value-to-text-field-with-auto-complete/172009>\
**Category:** Rails\
**Created:** [July 13, 2009, 11:40am UTC](https://www.ruby-forum.com/t/how-to-add-default-value-to-text-field-with-auto-complete/172009 "2009-07-13T11:40:45Z")\
**Posts on this page:** 4\
**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:** [July 13, 2009, 11:40am UTC](https://www.ruby-forum.com/t/how-to-add-default-value-to-text-field-with-auto-complete/172009/1 "2009-07-13T11:40:45Z")

</div>

I can’t find the way in rails api of how to add default value in  
text\_field\_with\_auto\_complete. Anyone know please teach me.  
Thank you.

---

<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:** [July 13, 2009, 11:55am UTC](https://www.ruby-forum.com/t/how-to-add-default-value-to-text-field-with-auto-complete/172009/2 "2009-07-13T11:55:53Z")

</div>

Am 13.07.2009 um 11:40 schrieb Thriving K.:

> I can’t find the way in rails api of how to add default value in  
> text\_field\_with\_auto\_complete. Anyone know please teach me.

I come up with this after 20s of googling:

text\_field\_with\_auto\_complete foo, bar, :tag\_options =\> { :value =\>  
“some default text” }

Doc for text\_field\_with\_auto\_complete is here  
[http://api.rubyonrails.org/classes/ActionView/Helpers/JavaScriptMacrosHelper.html#M000579](http://api.rubyonrails.org/classes/ActionView/Helpers/JavaScriptMacrosHelper.html#M000579)  
, the tag\_options hash can hold the same stuff as the options hash  
in text\_field\_tag

> **[ActionView::Helpers::FormTagHelper](https://api.rubyonrails.org/classes/ActionView/Helpers/FormTagHelper.html#M002016)**
>
> Provides a number of methods for creating form tags that don't rely on an Active Record object assigned to the template like FormHelper does. Instead, you provide the names and values manually.

.

Felix

---

<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:** [July 13, 2009, 12:44pm UTC](https://www.ruby-forum.com/t/how-to-add-default-value-to-text-field-with-auto-complete/172009/3 "2009-07-13T12:44:13Z")

</div>

Thank you a lot, i will try harder next time

---

<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:** [July 14, 2009, 5:55am UTC](https://www.ruby-forum.com/t/how-to-add-default-value-to-text-field-with-auto-complete/172009/4 "2009-07-14T05:55:26Z")

</div>

It works know , thank you  
i come up with this

= text\_field\_with\_auto\_complete :projecttag, :name,{:value  
=\>“555”},{:skip\_style =\> true}
