# Preload form fields with vaiables

**URL:** <https://www.ruby-forum.com/t/preload-form-fields-with-vaiables/170192>\
**Category:** Rails\
**Created:** [June 13, 2009, 2:40pm UTC](https://www.ruby-forum.com/t/preload-form-fields-with-vaiables/170192 "2009-06-13T14:40:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![JannaB](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/df788c/32.png) [@JannaB](https://www.ruby-forum.com/u/JannaB)\
**Post date:** [June 13, 2009, 2:40pm UTC](https://www.ruby-forum.com/t/preload-form-fields-with-vaiables/170192/1 "2009-06-13T14:40:16Z")

</div>

I have the following for which uses javascript to preload a couple of  
fields but it doesn’t work on a Blackberry (even IF javascript is  
enabled there). Is there a non-javascript way of preloading the fields  
I have in my form below? Thanks, Janna

# Send Email
\<% form\_remote\_tag :update =\> 'Body', :url =\> {:controller =\> 'emailer', :action =\> 'sendmail'}, :html =\> {:name =\> 'form'+(params [:id]).to\_s} do %\>

Subject: \<%= text\_field 'email', 'subject' %\>

Recipient: \<%= text\_field 'email', 'recipient', :readonly =\> 'true' %\>

Message  
\<%= text\_area 'email', 'message' %\>

\<%= submit\_tag "Send"%\> \<% end %\>

---

<div class="post-metadata">

**Author:** ![JannaB](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/df788c/32.png) [@JannaB](https://www.ruby-forum.com/u/JannaB)\
**Post date:** [June 13, 2009, 4:16pm UTC](https://www.ruby-forum.com/t/preload-form-fields-with-vaiables/170192/2 "2009-06-13T16:16:28Z")

</div>

On 13 Jun 2009, at 13:36, JannaB [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I have the following for which uses javascript to preload a couple of  
> fields but it doesn’t work on a Blackberry (even IF javascript is  
> enabled there). Is there a non-javascript way of preloading the fields  
> I have in my form below? Thanks, Janna  
> If your @email object has attributes called subject and so on,  
> text\_field will take the value from there, if not the helpers take an  
> option (:value) or an argument to set what the initial value should be

Fred

---

<div class="post-metadata">

**Author:** ![JannaB](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/df788c/32.png) [@JannaB](https://www.ruby-forum.com/u/JannaB)\
**Post date:** [June 13, 2009, 5:08pm UTC](https://www.ruby-forum.com/t/preload-form-fields-with-vaiables/170192/3 "2009-06-13T17:08:01Z")

</div>

Yes yes…here it is, I have it working and here is the syntax, in  
case someone searches and arrives here in the future. Thansk  
Frederick!

\<%= text\_field ‘email’, ‘recipient’, {:value =\> getAddy(params  
[:id]), :readonly =\> ‘true’} %\>

# Janna B

On Jun 13, 10:15 am, Frederick C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
