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 <h1>Send Email</h1> <% form_remote_tag :update => ''Body'', :url => {:controller => ''emailer'', :action => ''sendmail''}, :html => {:name => ''form''+(params [:id]).to_s} do %> <p><label for="email_subject">Subject</label>: <%= text_field ''email'', ''subject'' %></p> <p><label for="email_recipient">Recipient</label>: <%= text_field ''email'', ''recipient'', :readonly => ''true'' %></p> <p><label for="email_message">Message</label><br/> <%= text_area ''email'', ''message'' %></p> <%= submit_tag "Send"%> <% end %> <script> var r = ''<%= getAddy(params[''id'']) %>''; document.<%= ''form''+(params[''id'']).to_s %>.email_recipient.value r; var s = ''<%= getSub(params[''id'']) %>''; document.<%= ''form''+(params[''id'']).to_s %>.email_subject.value s; </script>
On 13 Jun 2009, at 13:36, JannaB <mistressjanna-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org> 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, JannaIf 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> > > <h1>Send Email</h1> > <% form_remote_tag :update => ''Body'', :url => {:controller => > ''emailer'', :action => ''sendmail''}, :html => {:name => ''form''+(params > [:id]).to_s} do %> > <p><label for="email_subject">Subject</label>: > <%= text_field ''email'', ''subject'' %></p> > <p><label for="email_recipient">Recipient</label>: > <%= text_field ''email'', ''recipient'', :readonly => ''true'' %></p> > <p><label for="email_message">Message</label><br/> > <%= text_area ''email'', ''message'' %></p> > <%= submit_tag "Send"%> > <% end %> > <script> > var r = ''<%= getAddy(params[''id'']) %>''; > document.<%= ''form''+(params[''id'']).to_s %>.email_recipient.value > r; > var s = ''<%= getSub(params[''id'']) %>''; > document.<%= ''form''+(params[''id'']).to_s %>.email_subject.value > s; > </script> > >
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''} %></p> # Janna B On Jun 13, 10:15 am, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 13 Jun 2009, at 13:36, JannaB <mistressja...-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org> 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 > > > > > <h1>Send Email</h1> > > <% form_remote_tag :update => ''Body'', :url => {:controller => > > ''emailer'', :action => ''sendmail''}, :html => {:name => ''form''+(params > > [:id]).to_s} do %> > > <p><label for="email_subject">Subject</label>: > > <%= text_field ''email'', ''subject'' %></p> > > <p><label for="email_recipient">Recipient</label>: > > <%= text_field ''email'', ''recipient'', :readonly => ''true'' %></p> > > <p><label for="email_message">Message</label><br/> > > <%= text_area ''email'', ''message'' %></p> > > <%= submit_tag "Send"%> > > <% end %> > > <script> > > var r = ''<%= getAddy(params[''id'']) %>''; > > document.<%= ''form''+(params[''id'']).to_s %>.email_recipient.value > > r; > > var s = ''<%= getSub(params[''id'']) %>''; > > document.<%= ''form''+(params[''id'']).to_s %>.email_subject.value > > s; > > </script>